Re: getting all groups where a user belongs to

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: getting all groups where a user belongs to
Дата
Msg-id 14261.1252277776@sss.pgh.pa.us
обсуждение исходный текст
Ответ на getting all groups where a user belongs to  (Keresztury Balázs <balazs@gaslightmusic.hu>)
Список pgsql-general
=?iso-8859-2?Q?Keresztury_Bal=E1zs?= <balazs@gaslightmusic.hu> writes:
> For example: there is a Service user, called Joe, who belongs to the group
> called SER. There is an other one, Kim, who's an administrator (ADM), which
> inherits rights from both SER and CEO. My problem is that I need a query,
> which returns _all_ the group names which Kim belongs to.
> I already find a solution to get the direct parents of a role, but I'd like
> to have all of them to use it for access control.

You could do something like

select rolname from pg_roles where pg_has_role('Kim', rolname, 'USAGE');

but this isn't going to be terribly efficient if you do it over and
over.  You should probably think twice about whether you really need
that data in explicit form on the client side.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Johan Nel
Дата:
Сообщение: Re: getting all groups where a user belongs to
Следующее
От: Tom Lane
Дата:
Сообщение: Re: More Snow Leopard problems...