11 select perm.code as "Permission",
12 perm.description as "Description",
13 grp.name as "Permission Level",
15 when map.depth = 0 then 'Consortium'
16 when map.depth = 1 then 'System'
17 when map.depth = 2 then 'Branch'
20 when map.grantable = true then 'Grantable'
21 when map.grantable = false then 'Not Grantable'
23 from permission.grp_tree grp
24 join permission.grp_perm_map map on (map.grp = grp.id)
25 join permission.perm_list perm on (map.perm = perm.id)
28 from permission.grp_ancestors(
34 where barcode = '$USER_BARCODE'
40 select perm2.code as "Permission",
41 perm2.description as "Description",
42 'Per-User Assignment' as "Permission Level",
44 when map2.depth = 0 then 'Consortium'
45 when map2.depth = 1 then 'System'
46 when map2.depth = 2 then 'Branch'
49 when map2.grantable = true then 'Grantable'
50 when map2.grantable = false then 'Not Grantable'
52 from permission.usr_perm_map map2
53 join permission.perm_list perm2 on (map2.perm = perm2.id)
57 where barcode = '$USER_BARCODE')
59 select perm3.code as "Permission",
60 perm3.description as "Description",
61 'Secondary: ' || grp3.name as "Permission Level",
63 when grp_perms.depth = 0 then 'Consortium'
64 when grp_perms.depth = 1 then 'System'
65 when grp_perms.depth = 2 then 'Branch'
68 when grp_perms.grantable = true then 'Grantable'
69 when grp_perms.grantable = false then 'Not Grantable'
71 from permission.usr_grp_map map3
72 join permission.grp_perm_map grp_perms on (map3.grp = grp_perms.grp)
73 join permission.grp_tree grp3 on (map3.grp = grp3.id)
74 join permission.perm_list perm3 on (grp_perms.perm = perm3.id)
78 where barcode = '$USER_BARCODE')
83 $PSQL -U $PSQL_USER -h $DB_HOST -1 -c "$SQL"