Loading...
Searching...
No Matches
dc_getusergroups.sas
Go to the documentation of this file.
1/**
2 @file dc_getusergroups.sas
3 @brief Gets the groups a user belongs to
4 @details There are three versions of this macro - a META, a VIYA and a SERVER
5 version (in different folders). The arguments are the same; the output
6 columns are whatever that platform's own group listing returns. This version
7 is VIYA.
8
9 Returns the group memberships of a particular user, defaulting to the session
10 user when none is named - %mv_getusergroups passes a blank user straight
11 through to a membership URL with no user in it, which answers no rows.
12
13 %mv_getusergroups answers the identities API's id / name / providerId, and
14 this version renames two of them: GROUPNAME carries the identity id, which is
15 the value the Viya sas_group column offers as its raw values, and GROUPDESC
16 carries the display name. The rest of the response reaches &outds as it
17 arrived - providerId, plus the ordinal and implicit columns the JSON libname
18 adds. There is no GROUPURI here: on Viya the group screen reads
19 /identities/groups itself and never opens a group by this member.
20
21 <h4> SAS Macros </h4>
22 @li mf_getuser.sas
23 @li mv_getusergroups.sas
24
25 @param [in] user= The user to read group memberships for (default: the
26 session user)
27 @param [out] outds= (mm_getgroups) the membership dataset: GROUPNAME (the
28 id) and GROUPDESC (the name), plus providerId and the ordinal / implicit
29 columns that %mv_getusergroups returns
30
31 @version 3.6
32 @author 4GL Apps Ltd
33 @copyright 4GL Apps Ltd. This code may only be used within Data Controller
34 and may not be re-distributed or re-sold without the express permission of
35 4GL Apps Ltd.
36**/
37
38%macro dc_getusergroups(user=,outds=mm_getgroups);
39 %if %sysevalf(%superq(user)=,boolean) %then %let user=%mf_getuser();
40 %mv_getusergroups(&user,outds=&outds)
41 data &outds;
42 length groupname groupdesc $256;
43 set &outds(rename=(id=groupname name=groupdesc));
44 run;
45%mend dc_getusergroups;