473,804 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,suppl ierallowed), 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 1420
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,suppl ierallowed), 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 YourEmailAddres sHere" to ma*******@postg resql.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,su pplierallowed), 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 YourEmailAddres sHere" to ma*******@postg resql.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,suppl ierallowed), 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 YourEmailAddres sHere" to ma*******@postg resql.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
2583
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 strip out any part of RestrictedPython that's not necessary for doing capabilities and do all security using just capabilities. The basic idea behind capabilities is that you don't give any piece of code you don't trust a reference to something...
13
4035
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 environment, which basically means that I want to allow only a specific set of modules to be used by the scripts, so that it wouldn't be possible for them to remove files from the hard drive, kill processes or do other nasty stuff. Is there any...
1
1458
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 attempts to update, or even selects from?
5
2601
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 accesses to the object must go through that parameter. Does this mean that printf("%s", "%s");
0
1107
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 component from C# client hidden/restricted attributes seems to have no effect. Is there any way to restrict C# client's access to certain
1
7763
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 machine folder) it gives me Access denied error. How can I programmatically give permission to the foder for restrcited user.
21
1728
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 to access only his particular folder, I dont want to create uses in unix, e.g fp = open(PATH, 'w') # If this PATH is defined then use can access files else he cant .. is there is any way?
0
4544
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 "Restricted data type attribute violation" and Query Analyzer is hanging up
3
2645
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 "logging/__init__.py", line 421, in format RuntimeError: instance.__dict__ not accessible in restricted mode I'm not sure what it means. Googling leads me to <http://docs.python.org/lib/restricted.htmlbut that says that those
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.