@sasjs/core 4.28.0 → 4.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.28.0"
38
+ "version": "4.30.1"
39
39
  }
@@ -9,12 +9,17 @@
9
9
 
10
10
  %ms_getgroups(outds=userlist)
11
11
 
12
- With filter:
12
+ With filter on username:
13
13
 
14
14
  %ms_getgroups(outds=userlist, user=James)
15
15
 
16
+ With filter on userid:
17
+
18
+ %ms_getgroups(outds=userlist, uid=1)
19
+
16
20
  @param [in] mdebug= (0) Set to 1 to enable DEBUG messages
17
21
  @param [in] user= (0) Provide the username on which to filter
22
+ @param [in] uid= (0) Provide the userid on which to filter
18
23
  @param [out] outds= (work.ms_getgroups) This output dataset will contain the
19
24
  list of groups. Format:
20
25
  |NAME:$32.|DESCRIPTION:$64.|GROUPID:best.|
@@ -37,6 +42,7 @@
37
42
 
38
43
  %macro ms_getgroups(
39
44
  user=0,
45
+ uid=0,
40
46
  outds=work.ms_getgroups,
41
47
  mdebug=0
42
48
  );
@@ -86,8 +92,10 @@ run;
86
92
  run;
87
93
  %end;
88
94
 
89
- %if "&user"="0" %then %let url=/SASjsApi/group;
90
- %else %let url=/SASjsApi/user/by/username/&user;
95
+ %if "&user" ne "0" %then %let url=/SASjsApi/user/by/username/&user;
96
+ %else %if "&uid" ne "0" %then %let url=/SASjsApi/user/&uid;
97
+ %else %let url=/SASjsApi/group;
98
+
91
99
 
92
100
  proc http method='GET' headerin=&fref0 out=&fref1
93
101
  url="&_sasjs_apiserverurl.&url";
@@ -104,7 +112,7 @@ run;
104
112
 
105
113
  libname &libref JSON fileref=&fref1;
106
114
 
107
- %if "&user"="0" %then %do;
115
+ %if "&user"="0" and "&uid"="0" %then %do;
108
116
  data &outds;
109
117
  length NAME $32 DESCRIPTION $64. GROUPID 8;
110
118
  if _n_=1 then call missing(of _all_);
@@ -8,12 +8,17 @@
8
8
 
9
9
  %ms_getusers(outds=userlist)
10
10
 
11
- Filtering for a group:
11
+ Filtering for a group by group name:
12
12
 
13
13
  %ms_getusers(outds=work.groupmembers, group=GROUPNAME)
14
14
 
15
+ Filtering for a group by group id:
16
+
17
+ %ms_getusers(outds=work.groupmembers, gid=1)
18
+
15
19
  @param [in] mdebug= (0) Set to 1 to enable DEBUG messages
16
20
  @param [in] group= (0) Set to a group name to filter members for that group
21
+ @param [in] gid= (0) Set to a group id to filter members for that group
17
22
  @param [out] outds= (work.ms_getusers) This output dataset will contain the
18
23
  list of user accounts. Format:
19
24
  |DISPLAYNAME:$60.|USERNAME:$30.|ID:best.|
@@ -25,7 +30,6 @@
25
30
  |`New User `|`newuser `|`5`|
26
31
 
27
32
 
28
-
29
33
  <h4> SAS Macros </h4>
30
34
  @li mf_getuniquefileref.sas
31
35
  @li mf_getuniquelibref.sas
@@ -41,6 +45,7 @@
41
45
  %macro ms_getusers(
42
46
  outds=work.ms_getusers,
43
47
  group=0,
48
+ gid=0,
44
49
  mdebug=0
45
50
  );
46
51
 
@@ -55,6 +60,19 @@
55
60
  %let fref1=%mf_getuniquefileref();
56
61
  %let libref=%mf_getuniquelibref();
57
62
 
63
+ %if %sysget(MODE)=desktop %then %do;
64
+ /* users api does not exist in desktop mode */
65
+ data &outds;
66
+ length DISPLAYNAME $60 USERNAME:$30 ID 8;
67
+ USERNAME="&sysuserid";
68
+ DISPLAYNAME="&sysuserid (desktop mode)";
69
+ ID=1;
70
+ output;
71
+ stop;
72
+ run;
73
+ %return;
74
+ %end;
75
+
58
76
  /* avoid sending bom marker to API */
59
77
  %let optval=%sysfunc(getoption(bomfile));
60
78
  options nobomfile;
@@ -75,9 +93,9 @@ run;
75
93
  run;
76
94
  %end;
77
95
 
78
- %if "&group"="0" %then %let url=/SASjsApi/user;
79
- %else %let url=/SASjsApi/group/by/groupname/&group;
80
-
96
+ %if "&group" ne "0" %then %let url=/SASjsApi/group/by/groupname/&group;
97
+ %else %if "&gid" ne "0" %then %let url=/SASjsApi/group/&gid;
98
+ %else %let url=/SASjsApi/user;
81
99
 
82
100
  proc http method='GET' headerin=&fref0 out=&fref1
83
101
  url="&_sasjs_apiserverurl.&url";
@@ -95,7 +113,7 @@ run;
95
113
 
96
114
  libname &libref JSON fileref=&fref1;
97
115
 
98
- %if "&group"="0" %then %do;
116
+ %if "&group"="0" and "&gid"="0" %then %do;
99
117
  data &outds;
100
118
  length DISPLAYNAME $60 USERNAME:$30 ID 8;
101
119
  set &libref..root;