Обсуждение: Role members

Поиск
Список
Период
Сортировка

Role members

От
"Akmal Akmalhojaev"
Дата:
Hello! I have the following question.<br /><br />For example I have a role ID1 with members ID2 and ID3.<br />Role ID2
hasalso members ID4 and ID5. It means that roles ID4 and ID5 are members of ID1.<br />The question: Is there any
functionin PostgreSQL, that finds all the members of role ID1 - even such members, as ID4 and ID5. <br /><br />Thanks.  

Re: Role members

От
Richard Huxton
Дата:
Akmal Akmalhojaev wrote:
> Hello! I have the following question.
> 
> For example I have a role ID1 with members ID2 and ID3.
> Role ID2 has also members ID4 and ID5. It means that roles ID4 and ID5 are
> members of ID1.
> The question: Is there any function in PostgreSQL, that finds all the
> members of role ID1 - even such members, as ID4 and ID5.

Akmal, this isn't really a question for the hackers list. Please try on 
"general" or "admin".

However, I know of no function that will recursively expand member 
lists. You could easily write your own of course, but you'll want to 
decide how to handle the "inherits" flag.

--   Richard Huxton  Archonet Ltd


Re: Role members

От
Richard Huxton
Дата:
Akmal Akmalhojaev wrote:
> It doesn't mean if there is "inherit" flag. I'm looking for a C function
> like SearchSysCache() or smth.

Ah - I think the file you neeed to look in is backend/utils/adt/acl.c - 
I think it's looking at things the other way around. That is - is the 
current role a member of role X rather than list all the roles that are 
members of X.

--   Richard Huxton  Archonet Ltd