Re: Advice needed on application/database authentication/authorization/auditing model

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Advice needed on application/database authentication/authorization/auditing model
Date: 2010-10-24 16:04:23
Message-ID: 861v7fd1bs.fsf@mgm.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <20101022161331(dot)GD9770(at)frohike(dot)homeunix(dot)org>,
Peter Bex <Peter(dot)Bex(at)xs4all(dot)nl> writes:

> As far as I can see, this would imply either creating views on the
> <whatever> for every user (or company?), or manually crafting queries
> to do the same.

Not necessarily. Consider this:

CREATE TABLE t1 (
id serial NOT NULL,
val int NOT NULL,
usr text NOT NULL,
PRIMARY KEY (id)
);

COPY t1 (val, usr) FROM stdin;
1 u1
2 u1
3 u2
4 u3
\.

CREATE VIEW t1v (id, val) AS
SELECT id, val
FROM t1
WHERE usr = current_user;

Now user "u1" can only see rows 1 and 2.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-10-24 16:33:57 Re: What is "return code" for WAL send command
Previous Message zhong ming wu 2010-10-24 14:37:06 Re: What is "return code" for WAL send command