wiki:sysadminSeeingWhichGroupsAUserBelongsTo

Version 3 (modified by Dan Scott, 11 years ago) (diff)

--

Seeing which groups a user belongs to

There are some good magic spells for this kind of stuff at Evergreen magic spells.

evergreen=# SELECT pgt.name 
  FROM permission.grp_tree pgt 
  INNER JOIN permission.usr_grp_map pugm on pugm.grp = pgt.id 
  INNER JOIN actor.usr aou ON aou.id = pugm.usr 
  WHERE aou.family_name = 'Scott' 
  AND aou.first_given_name = 'Daniel'
;
            name            
----------------------------
 Super circulators
 Super cataloguers
 Local System Administrator
(3 rows)

And work org_units:

evergreen=# SELECT aou.name 
  FROM actor.org_unit aou 
  INNER JOIN permission.usr_work_ou_map puwm ON puwm.work_ou = aou.id 
  INNER JOIN actor.usr au ON au.id = puwm.usr 
  WHERE au.family_name = 'Scott' 
  AND au.first_given_name = 'Daniel'
;
          name           
-------------------------
 J.N. Desmarais Library
 Leddy Library
 Paul Martin Law Library
(3 rows)