Re: check user in group
От | Pavel Stehule |
---|---|
Тема | Re: check user in group |
Дата | |
Msg-id | CAFj8pRB3a-kuiCNvHcwxjRKb7yCQP3_Si034ut-vTrzQRbQpnw@mail.gmail.com обсуждение исходный текст |
Ответ на | check user in group (Philipp Kraus <philipp.kraus@flashpixx.de>) |
Список | pgsql-general |
Hello you can try create or replace function is_member_of(text, text) returns boolean as $$ select exists(select rolname from pg_catalog.pg_auth_members m JOIN pg_catalog.pg_roles b ON m.roleid = b.oid where m.member = (select oid from pg_roles where rolname = $1) and rolname = $2) $$ language sql ; postgres=# select is_member_of('pavel','admin'); is_member_of -------------- t (1 row) Regards Pavel Stehule 2012/12/25 Philipp Kraus <philipp.kraus@flashpixx.de>: > Hello, > > how can I check if a user is within a group? I use current_user() to get the logged-in user, but I have a group "service"and I need a check if the user is member of the group > > Thanks > > Phil > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general
В списке pgsql-general по дате отправления: