pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Discovering privileges
6+ messages / 3 participants
[nested] [flat]

* Discovering privileges
@ 2005-03-20 14:50 Murray Cumming <murrayc@murrayc.com>
  2005-03-20 15:42 ` Re: Discovering privileges Michael Fuhr <mike@fuhr.org>
  2005-03-20 15:52 ` Re: Discovering privileges Bruno Wolff III <bruno@wolff.to>
  0 siblings, 2 replies; 6+ messages in thread

From: Murray Cumming @ 2005-03-20 14:50 UTC (permalink / raw)
  To: pgsql-interfaces

I'm using the pg_user and pg_group system tables to discover the list of
users, and the groups to which they belong.

But how can I discover the privileges that these users and groups have
for the various tables. Is this also in one of the system tables?

-- 
Murray Cumming
murrayc@murrayc.com
www.murrayc.com
www.openismus.com




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Discovering privileges
  2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
@ 2005-03-20 15:42 ` Michael Fuhr <mike@fuhr.org>
  2005-03-20 16:45   ` Re: Discovering privileges Murray Cumming <murrayc@murrayc.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Michael Fuhr @ 2005-03-20 15:42 UTC (permalink / raw)
  To: Murray Cumming <murrayc@murrayc.com>; +Cc: pgsql-interfaces

On Sun, Mar 20, 2005 at 03:50:30PM +0100, Murray Cumming wrote:

> I'm using the pg_user and pg_group system tables to discover the list of
> users, and the groups to which they belong.
> 
> But how can I discover the privileges that these users and groups have
> for the various tables. Is this also in one of the system tables?

You could look at pg_class.relacl, but the "Access Privilege Inquiry
Functions" (has_table_privilege(), etc.) might be easier to use.

http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Discovering privileges
  2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
  2005-03-20 15:42 ` Re: Discovering privileges Michael Fuhr <mike@fuhr.org>
@ 2005-03-20 16:45   ` Murray Cumming <murrayc@murrayc.com>
  2005-03-20 17:02     ` Re: Discovering privileges Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Murray Cumming @ 2005-03-20 16:45 UTC (permalink / raw)
  To: Michael Fuhr <mike@fuhr.org>; +Cc: pgsql-interfaces

On Sun, 2005-03-20 at 08:42 -0700, Michael Fuhr wrote:
> On Sun, Mar 20, 2005 at 03:50:30PM +0100, Murray Cumming wrote:
> 
> > I'm using the pg_user and pg_group system tables to discover the list of
> > users, and the groups to which they belong.
> > 
> > But how can I discover the privileges that these users and groups have
> > for the various tables. Is this also in one of the system tables?
> 
> You could look at pg_class.relacl,

I can't make much sense of that so far. Ca you give any clues on how
that works?

>  but the "Access Privilege Inquiry
> Functions" (has_table_privilege(), etc.) might be easier to use.
> 
> http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE

Interesting. Is there anything like that for a group instead of a user?
I'm most interested in privileges of a group.

Thanks.

-- 
Murray Cumming
murrayc@murrayc.com
www.murrayc.com
www.openismus.com




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Discovering privileges
  2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
  2005-03-20 15:42 ` Re: Discovering privileges Michael Fuhr <mike@fuhr.org>
  2005-03-20 16:45   ` Re: Discovering privileges Murray Cumming <murrayc@murrayc.com>
@ 2005-03-20 17:02     ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Fuhr @ 2005-03-20 17:02 UTC (permalink / raw)
  To: Murray Cumming <murrayc@murrayc.com>; +Cc: pgsql-interfaces

On Sun, Mar 20, 2005 at 05:45:29PM +0100, Murray Cumming wrote:
> On Sun, 2005-03-20 at 08:42 -0700, Michael Fuhr wrote:
> >
> > You could look at pg_class.relacl,
> 
> I can't make much sense of that so far. Ca you give any clues on how
> that works?

See "Notes" in the GRANT documentation:

http://www.postgresql.org/docs/8.0/interactive/sql-grant.html

> >  but the "Access Privilege Inquiry
> > Functions" (has_table_privilege(), etc.) might be easier to use.
> > 
> > http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE
> 
> Interesting. Is there anything like that for a group instead of a user?
> I'm most interested in privileges of a group.

Hmmm...not sure.  I suppose you could create a user that belongs
only to a particular group and check that user's privileges.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Discovering privileges
  2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
@ 2005-03-20 15:52 ` Bruno Wolff III <bruno@wolff.to>
  2005-03-20 16:01   ` Re: Discovering privileges Michael Fuhr <mike@fuhr.org>
  1 sibling, 1 reply; 6+ messages in thread

From: Bruno Wolff III @ 2005-03-20 15:52 UTC (permalink / raw)
  To: Murray Cumming <murrayc@murrayc.com>; +Cc: pgsql-interfaces

On Sun, Mar 20, 2005 at 15:50:30 +0100,
  Murray Cumming <murrayc@murrayc.com> wrote:
> I'm using the pg_user and pg_group system tables to discover the list of
> users, and the groups to which they belong.
> 
> But how can I discover the privileges that these users and groups have
> for the various tables. Is this also in one of the system tables?

In recent (7.4+ I think) versions of Postgres there are functions provided
for testing access to tables.

Look at table 9-40 in section 9.19 of the version 8 manual.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Discovering privileges
  2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
  2005-03-20 15:52 ` Re: Discovering privileges Bruno Wolff III <bruno@wolff.to>
@ 2005-03-20 16:01   ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Fuhr @ 2005-03-20 16:01 UTC (permalink / raw)
  To: Bruno Wolff III <bruno@wolff.to>; Murray Cumming <murrayc@murrayc.com>; pgsql-interfaces

On Sun, Mar 20, 2005 at 09:52:30AM -0600, Bruno Wolff III wrote:

> In recent (7.4+ I think) versions of Postgres there are functions provided
> for testing access to tables.

According to the Release Notes, has_table_privilege() was introduced
in 7.2.  The other privilege-testing functions appear to have been
introduced in 7.3 (except has_tablespace_privilege(), which is new
in 8.0).

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2005-03-20 17:02 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-20 14:50 Discovering privileges Murray Cumming <murrayc@murrayc.com>
2005-03-20 15:42 ` Michael Fuhr <mike@fuhr.org>
2005-03-20 16:45   ` Murray Cumming <murrayc@murrayc.com>
2005-03-20 17:02     ` Michael Fuhr <mike@fuhr.org>
2005-03-20 15:52 ` Bruno Wolff III <bruno@wolff.to>
2005-03-20 16:01   ` Michael Fuhr <mike@fuhr.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox