diff --git a/all.sas b/all.sas index 656be03..10109be 100644 --- a/all.sas +++ b/all.sas @@ -20424,7 +20424,7 @@ options &optval; @param [in] group= (0) Set to a group name to filter members for that group @param [out] outds= (work.ms_getusers) This output dataset will contain the list of user accounts. Format: -|DISPLAYNAME:$18.|USERNAME:$10.|ID:best.| +|DISPLAYNAME:$60.|USERNAME:$30.|ID:best.| |---|---|---| |`Super Admin `|`secretuser `|`1`| |`Sabir Hassan`|`sabir`|`2`| @@ -20437,9 +20437,7 @@ options &optval;

SAS Macros

@li mf_getuniquefileref.sas @li mf_getuniquelibref.sas - @li mf_getuniquename.sas @li mp_abort.sas - @li ms_getgroups.sas

Related Files

@li ms_createuser.sas @@ -20460,7 +20458,7 @@ options &optval; ,msg=%str(syscc=&syscc on macro entry) ) -%local fref0 fref1 libref optval rc msg; +%local fref0 fref1 libref optval rc msg url; %let fref0=%mf_getuniquefileref(); %let fref1=%mf_getuniquefileref(); %let libref=%mf_getuniquelibref(); @@ -20484,35 +20482,18 @@ run; put _infile_; run; %end; -%if "&group"="0" %then %do; - proc http method='GET' headerin=&fref0 out=&fref1 - url="&_sasjs_apiserverurl/SASjsApi/user"; - %if &mdebug=1 %then %do; - debug level=1; - %end; - run; -%end; -%else %do; - /* currently we only have an API to fetch by group ID */ - /* so first fetch all the groups, and grab the id */ - %local groupid ds1; - %let ds1=%mf_getuniquename(prefix=groups); - %ms_getgroups(outds=&ds1) - data _null_; - set &ds1; - where name="&group"; - call symputx('groupid',groupid,'l'); - run; - proc http method='GET' headerin=&fref0 out=&fref1 - url="&_sasjs_apiserverurl/SASjsApi/group/&groupid"; - %if &mdebug=1 %then %do; - debug level=1; - %put &=groupid; - %end; - run; +%if "&group"="0" %then %let url=/SASjsApi/user; +%else %let url=/SASjsApi/group/by/groupname/&group; + +proc http method='GET' headerin=&fref0 out=&fref1 + url="&_sasjs_apiserverurl.&url"; +%if &mdebug=1 %then %do; + debug level=1; %end; +run; + %mp_abort( iftrue=(&syscc ne 0) @@ -20524,12 +20505,14 @@ libname &libref JSON fileref=&fref1; %if "&group"="0" %then %do; data &outds; + length DISPLAYNAME $60 USERNAME:$30 ID 8; set &libref..root; drop ordinal_root; run; %end; %else %do; data &outds; + length DISPLAYNAME $60 USERNAME:$30 ID 8; set &libref..users; drop ordinal_root ordinal_users; run; diff --git a/sasjs/sasjsconfig.json b/sasjs/sasjsconfig.json index de6d74a..ae89c0e 100644 --- a/sasjs/sasjsconfig.json +++ b/sasjs/sasjsconfig.json @@ -67,7 +67,7 @@ }, { "name": "server", - "serverUrl": "https://sas.4gl.io:5001", + "serverUrl": "https://sas.4gl.io", "serverType": "SASJS", "httpsAgentOptions": { "allowInsecureRequests": false diff --git a/server/ms_getusers.sas b/server/ms_getusers.sas index a93e98c..17e5f86 100644 --- a/server/ms_getusers.sas +++ b/server/ms_getusers.sas @@ -16,7 +16,7 @@ @param [in] group= (0) Set to a group name to filter members for that group @param [out] outds= (work.ms_getusers) This output dataset will contain the list of user accounts. Format: -|DISPLAYNAME:$18.|USERNAME:$10.|ID:best.| +|DISPLAYNAME:$60.|USERNAME:$30.|ID:best.| |---|---|---| |`Super Admin `|`secretuser `|`1`| |`Sabir Hassan`|`sabir`|`2`| @@ -29,9 +29,7 @@

SAS Macros

@li mf_getuniquefileref.sas @li mf_getuniquelibref.sas - @li mf_getuniquename.sas @li mp_abort.sas - @li ms_getgroups.sas

Related Files

@li ms_createuser.sas @@ -52,7 +50,7 @@ ,msg=%str(syscc=&syscc on macro entry) ) -%local fref0 fref1 libref optval rc msg; +%local fref0 fref1 libref optval rc msg url; %let fref0=%mf_getuniquefileref(); %let fref1=%mf_getuniquefileref(); %let libref=%mf_getuniquelibref(); @@ -76,35 +74,18 @@ run; put _infile_; run; %end; -%if "&group"="0" %then %do; - proc http method='GET' headerin=&fref0 out=&fref1 - url="&_sasjs_apiserverurl/SASjsApi/user"; - %if &mdebug=1 %then %do; - debug level=1; - %end; - run; -%end; -%else %do; - /* currently we only have an API to fetch by group ID */ - /* so first fetch all the groups, and grab the id */ - %local groupid ds1; - %let ds1=%mf_getuniquename(prefix=groups); - %ms_getgroups(outds=&ds1) - data _null_; - set &ds1; - where name="&group"; - call symputx('groupid',groupid,'l'); - run; - proc http method='GET' headerin=&fref0 out=&fref1 - url="&_sasjs_apiserverurl/SASjsApi/group/&groupid"; - %if &mdebug=1 %then %do; - debug level=1; - %put &=groupid; - %end; - run; +%if "&group"="0" %then %let url=/SASjsApi/user; +%else %let url=/SASjsApi/group/by/groupname/&group; + +proc http method='GET' headerin=&fref0 out=&fref1 + url="&_sasjs_apiserverurl.&url"; +%if &mdebug=1 %then %do; + debug level=1; %end; +run; + %mp_abort( iftrue=(&syscc ne 0) @@ -116,12 +97,14 @@ libname &libref JSON fileref=&fref1; %if "&group"="0" %then %do; data &outds; + length DISPLAYNAME $60 USERNAME:$30 ID 8; set &libref..root; drop ordinal_root; run; %end; %else %do; data &outds; + length DISPLAYNAME $60 USERNAME:$30 ID 8; set &libref..users; drop ordinal_root ordinal_users; run; diff --git a/tests/serveronly/ms_creategroup.test.sas b/tests/serveronly/ms_creategroup.test.sas index cda4f7f..1fb778b 100644 --- a/tests/serveronly/ms_creategroup.test.sas +++ b/tests/serveronly/ms_creategroup.test.sas @@ -35,7 +35,7 @@ run; %let checkid=0; data _null_; set work.test2; - where name="&group"; + where upcase(name)="%upcase(&group)"; call symputx('checkid',groupid); run; %mp_assert( diff --git a/tests/serveronly/ms_createuser.test.sas b/tests/serveronly/ms_createuser.test.sas index 6749066..1cc1286 100644 --- a/tests/serveronly/ms_createuser.test.sas +++ b/tests/serveronly/ms_createuser.test.sas @@ -37,7 +37,7 @@ run; data _null_; set work.test2; if _n_<20 then putlog (_all_)(=); - if username="&user"; + if upcase(username)="%upcase(&user)"; call symputx('checkid',id); run; %mp_assert( diff --git a/tests/serveronly/ms_getgroups.test.sas b/tests/serveronly/ms_getgroups.test.sas index e95c4db..8c87d63 100644 --- a/tests/serveronly/ms_getgroups.test.sas +++ b/tests/serveronly/ms_getgroups.test.sas @@ -28,9 +28,12 @@ %mp_assertdsobs(work.test1,test=ATLEAST 1) %let test2=0; +%put &=group; data _null_; set work.test1; - if groupname="&group" then do; + putlog (_all_)(=); + if upcase(name)="%upcase(&group)" then do; + putlog "&group found!"; call symputx('test2',1); call symputx('gid',groupid); /* used in next test */ end;