473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Restricted query

Hello list,

This is an inventory system where some users are restricted to view only
certain suppliers, those restrictions are in a table called pedusers
(username,supplierallowed), there are other kind of "superuser" who are
not restricted, actually I created another table for them (userexcept).
To select restricted rows I use this code:

select * from prvdor
where prvtiprov = 2 and
prvpk in
(select usr_prvdor from peduser where
usr_login = 'default')
I think I would write this in a return set function instead but I would
like to know others ways to write a SQL sentence to return the rows
according users permission/restrictions.
Thanks in advance for your comments

--
Sinceramente,
Josué Maldonado.

"Vivir sin filosofar es, propiamente, tener los ojos cerrados, sin
tratar de abrirlos jamás." -- Descartes

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
3 1395
You could use a view and give group rights to a particular view.

Josué Maldonado wrote:
Hello list,

This is an inventory system where some users are restricted to view only
certain suppliers, those restrictions are in a table called pedusers
(username,supplierallowed), there are other kind of "superuser" who are
not restricted, actually I created another table for them (userexcept).
To select restricted rows I use this code:

select * from prvdor
where prvtiprov = 2 and
prvpk in
(select usr_prvdor from peduser where
usr_login = 'default')
I think I would write this in a return set function instead but I would
like to know others ways to write a SQL sentence to return the rows
according users permission/restrictions.
Thanks in advance for your comments


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2


Marco Lazzeri wrote:
And what about restricting UPDATE/DELETE queries too. Can I still use
VIEWs?
No but that you could use a function for.

Sincerely,

Joshua D. Drake

Bye

Il mer, 2004-05-19 alle 05:06, Joshua D. Drake ha scritto:
You could use a view and give group rights to a particular view.

Josué Maldonado wrote:

Hello list,

This is an inventory system where some users are restricted to view only
certain suppliers, those restrictions are in a table called pedusers
(username,supplierallowed), there are other kind of "superuser" who are
not restricted, actually I created another table for them (userexcept).
To select restricted rows I use this code:

select * from prvdor
where prvtiprov = 2 and
prvpk in
(select usr_prvdor from peduser where
usr_login = 'default')
I think I would write this in a return set function instead but I would
like to know others ways to write a SQL sentence to return the rows
according users permission/restrictions.
Thanks in advance for your comments


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
And what about restricting UPDATE/DELETE queries too. Can I still use
VIEWs?

Bye

Il mer, 2004-05-19 alle 05:06, Joshua D. Drake ha scritto:
You could use a view and give group rights to a particular view.

Josué Maldonado wrote:
Hello list,

This is an inventory system where some users are restricted to view only
certain suppliers, those restrictions are in a table called pedusers
(username,supplierallowed), there are other kind of "superuser" who are
not restricted, actually I created another table for them (userexcept).
To select restricted rows I use this code:

select * from prvdor
where prvtiprov = 2 and
prvpk in
(select usr_prvdor from peduser where
usr_login = 'default')


I think I would write this in a return set function instead but I would
like to know others ways to write a SQL sentence to return the rows
according users permission/restrictions.


Thanks in advance for your comments




---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Sean R. Lynch | last post by:
I've been playing around with Zope's RestrictedPython, and I think I'm on the way to making the modifications necessary to create a capabilities-based restricted execution system. The idea is to...
13
by: Rolf Magnus | last post by:
Hi, I would like to embed a python interpreter within a program, but since that program would be able to automatically download scripts from the internet, I'd like to run those in a restricted...
1
by: deko | last post by:
If I allow users to create a QueryDef by entering an sql statement in a text box, can I restrict that query to a specific table? Is there some way to throw an error based on what table a query...
5
by: Peter Ammon | last post by:
It's my understanding that the printf() function is declared as int printf(const char * restrict format, ...); in stdio.h. And loosely speaking, if a parameter is declared as restricted, then...
0
by: Jussi | last post by:
Hi! I have a COM server object in which I have set certain interfaces restricted/hidden. For example With VB client these attributes works as excpected. However if I use this same COM...
1
by: Kiran_Juikar | last post by:
In my application, I want to copy some file from network location to local machine folder. It works fine for administrator but If I run it with restricted user (not having permissions to local...
21
by: iapain | last post by:
I'm developing a webIDE for python and I've 2 questions regarding it. 1. How can i disable some of the modules without deleting. e.g I wish to disable "os" module. 2. How can i force user code...
0
by: vinodpatel | last post by:
HI I am loading some files using bulk insert from store procedure. Iand I am also using sp_OA... to move files to other folder Some time while Executing this store procedure I am getting ERROR...
3
by: Paul Rudin | last post by:
I'm occasionally seeing tracebacks like this: Traceback (most recent call last): File "logging/__init__.py", line 744, in emit File "logging/__init__.py", line 630, in format File...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.