Re: indirect membership in group roles

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kev <kevinjamesfield(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: indirect membership in group roles
Date: 2009-04-02 22:48:07
Message-ID: 14421.1238712487@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kev <kevinjamesfield(at)gmail(dot)com> writes:
> For some reason, which I couldn't see spelled out very well in the
> docs for GRANT ROLE and SET ROLE, indirect membership in the group
> "user" doesn't give one its privileges unless you SET ROLE "user"
> first, even if all roles involved have INHERIT set.

Really? Works for me:

regression=# create group student inherit;
CREATE ROLE
regression=# create group employee inherit;
CREATE ROLE
regression=# create group "user";
CREATE ROLE
regression=# grant "user" to student;
GRANT ROLE
regression=# grant "user" to employee;
GRANT ROLE
regression=# create user joe inherit;
CREATE ROLE
regression=# grant student to joe;
GRANT ROLE
regression=# create table mytable (f1 int);
CREATE TABLE
regression=# grant select on mytable to "user";
GRANT
regression=# \c - joe
psql (8.4devel)
You are now connected to database "regression" as user "joe".
regression=> select * from mytable;
f1
----
(0 rows)

I suspect you forgot to attach the "inherit" property to the
intermediate-level group.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-04-03 00:33:56 Re: [HACKERS] string_to_array with empty input
Previous Message Ricardo Fuentes 2009-04-02 21:05:03 Hello, i want to subscribe...