Hi all,
I am looking for a way to determine wether or not a user is a member of a
group...
if I do: SELECT * FROM pg_group;
I get something like this:
groname | grosysid | grolist
----------+----------+-----------------------
users | 103 | {100,102}
admins | 101 | {103,1}
guests | 100 | {101}
customer | 102 | {104,105,106,107,108}
that's pretty ok, and it appears that the members of the group are in an
array... arrays in a database... it's always been a blast to me, always
having trouble working with them, so I don't use arrays often... but here I
must *grin*
Anyway... I want to know if a user 'john' is member of 'admins', to
determine wether or not to show an administrative button on the website. I
was thinking of creating a function in PL/SQL, but I still have not the
hang of that... but it would be nice to do a:
SELECT * FROM is_member(john,admin); where it would return a boolean saying
yes or no...
or
SELECT * FROM is_member(john); where it would return a column with all the
groups john is member of...
maybe someone can help me out?
TIA,
Michiel