Re: [GENERAL] Conditioned access to a database - Mailing list pgsql-general

From tolik@icomm.ru (Anatoly K. Lasareff)
Subject Re: [GENERAL] Conditioned access to a database
Date
Msg-id 87emnw2da7.fsf@tolikus.hq.aaanet.ru
Whole thread Raw
In response to Conditioned access to a database  (Paulo da Silva <pdasilva@esoterica.pt>)
List pgsql-general
>>>>> "PdS" == Paulo da Silva <pdasilva@esoterica.pt> writes:

 PdS> Hello,
 PdS> I'm evaluating sql/postgresql for the following purpose:
 PdS> I need to have a database with lots of "records".
 PdS> I need to allow groups of users to access sets of
 PdS> those records grouped by the contents of one field.
 PdS> For example, the group A can only access records that
 PdS> have the dptm field = "A". Is this possible?

 PdS> If the subject is not simple, pls just tell me
 PdS> which doc to read.

Suppose you have table:

create table a (
  tag int,
  info text
);

and you want controll user's depend on the 'tag' field value. I think
you can do following:

create view v1 as select info from a where tag = 1;
create view v2 as select info from a where tag = 2;
create view v3 as select info from a where tag = 3;

revoke all on a from public;

grant select on v1 to user1, user2...;
grant select on v2 to group gr1, ...;
. . .


--
Anatoly K. Lasareff              Email:       tolik@icomm.ru
Senior programmer

pgsql-general by date:

Previous
From: Blashko Alexander
Date:
Subject: Re: [GENERAL] Problem with table,field names.
Next
From:
Date:
Subject: Undeliverable Message