mirror of
https://github.com/sasjs/core.git
synced 2026-01-05 00:20:05 +00:00
fix: using new user/by/username api in sasjs/server
This commit is contained in:
66
all.sas
66
all.sas
@@ -20300,7 +20300,7 @@ filename &headref clear;
|
|||||||
|
|
||||||
<h4> Related Files </h4>
|
<h4> Related Files </h4>
|
||||||
@li ms_creategroup.sas
|
@li ms_creategroup.sas
|
||||||
@li ms_getusers.test.sas
|
@li ms_getgroups.test.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -20312,11 +20312,11 @@ filename &headref clear;
|
|||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
,mac=ms_getusers.sas
|
,mac=ms_getgroups.sas
|
||||||
,msg=%str(syscc=&syscc on macro entry)
|
,msg=%str(syscc=&syscc on macro entry)
|
||||||
)
|
)
|
||||||
|
|
||||||
%local fref0 fref1 libref optval rc msg;
|
%local fref0 fref1 libref optval rc msg url;
|
||||||
|
|
||||||
%if %sysget(MODE)=desktop %then %do;
|
%if %sysget(MODE)=desktop %then %do;
|
||||||
/* groups api does not exist in desktop mode */
|
/* groups api does not exist in desktop mode */
|
||||||
@@ -20355,50 +20355,40 @@ run;
|
|||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if "&user"="0" %then %do;
|
%if "&user"="0" %then %let url=/SASjsApi/group;
|
||||||
proc http method='GET' headerin=&fref0 out=&fref1
|
%else %let url=/SASjsApi/user/by/username/&user;
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
||||||
%if &mdebug=1 %then %do;
|
proc http method='GET' headerin=&fref0 out=&fref1
|
||||||
debug level=1;
|
url="&_sasjs_apiserverurl.&url";
|
||||||
%end;
|
%if &mdebug=1 %then %do;
|
||||||
run;
|
debug level=1;
|
||||||
%end;
|
|
||||||
%else %do;
|
|
||||||
/*
|
|
||||||
first get the userid - cannot do this directly until the following ticket
|
|
||||||
is closed: https://github.com/sasjs/server/issues/188
|
|
||||||
*/
|
|
||||||
data;run;
|
|
||||||
%local ds1 uid;
|
|
||||||
%let ds1=&syslast;
|
|
||||||
%ms_getusers(outds=&ds1)
|
|
||||||
%let uid=0;
|
|
||||||
data _null_;
|
|
||||||
set &ds1;
|
|
||||||
if username="&user" then call symputx('uid',id,'l');
|
|
||||||
run;
|
|
||||||
proc http method='GET' headerin=&fref0 out=&fref1
|
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
||||||
%if &mdebug=1 %then %do;
|
|
||||||
debug level=1;
|
|
||||||
%end;
|
|
||||||
run;
|
|
||||||
%end;
|
%end;
|
||||||
|
run;
|
||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
,mac=ms_getgroups.sas
|
,mac=ms_getgroups.sas
|
||||||
,msg=%str(Issue submitting GET query to SASjsApi/group)
|
,msg=%str(Issue submitting GET query to SASjsApi)
|
||||||
)
|
)
|
||||||
|
|
||||||
libname &libref JSON fileref=&fref1;
|
libname &libref JSON fileref=&fref1;
|
||||||
|
|
||||||
data &outds;
|
%if "&user"="0" %then %do;
|
||||||
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
data &outds;
|
||||||
if _n_=1 then call missing(of _all_);
|
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
||||||
set &libref..root;
|
if _n_=1 then call missing(of _all_);
|
||||||
drop ordinal_root;
|
set &libref..root;
|
||||||
run;
|
drop ordinal_root;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
|
data &outds;
|
||||||
|
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
||||||
|
if _n_=1 then call missing(of _all_);
|
||||||
|
set &libref..groups;
|
||||||
|
drop ordinal_:;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<h4> Related Files </h4>
|
<h4> Related Files </h4>
|
||||||
@li ms_creategroup.sas
|
@li ms_creategroup.sas
|
||||||
@li ms_getusers.test.sas
|
@li ms_getgroups.test.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
,mac=ms_getusers.sas
|
,mac=ms_getgroups.sas
|
||||||
,msg=%str(syscc=&syscc on macro entry)
|
,msg=%str(syscc=&syscc on macro entry)
|
||||||
)
|
)
|
||||||
|
|
||||||
%local fref0 fref1 libref optval rc msg;
|
%local fref0 fref1 libref optval rc msg url;
|
||||||
|
|
||||||
%if %sysget(MODE)=desktop %then %do;
|
%if %sysget(MODE)=desktop %then %do;
|
||||||
/* groups api does not exist in desktop mode */
|
/* groups api does not exist in desktop mode */
|
||||||
@@ -86,50 +86,40 @@ run;
|
|||||||
run;
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
%if "&user"="0" %then %do;
|
%if "&user"="0" %then %let url=/SASjsApi/group;
|
||||||
proc http method='GET' headerin=&fref0 out=&fref1
|
%else %let url=/SASjsApi/user/by/username/&user;
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
||||||
%if &mdebug=1 %then %do;
|
proc http method='GET' headerin=&fref0 out=&fref1
|
||||||
debug level=1;
|
url="&_sasjs_apiserverurl.&url";
|
||||||
%end;
|
%if &mdebug=1 %then %do;
|
||||||
run;
|
debug level=1;
|
||||||
%end;
|
|
||||||
%else %do;
|
|
||||||
/*
|
|
||||||
first get the userid - cannot do this directly until the following ticket
|
|
||||||
is closed: https://github.com/sasjs/server/issues/188
|
|
||||||
*/
|
|
||||||
data;run;
|
|
||||||
%local ds1 uid;
|
|
||||||
%let ds1=&syslast;
|
|
||||||
%ms_getusers(outds=&ds1)
|
|
||||||
%let uid=0;
|
|
||||||
data _null_;
|
|
||||||
set &ds1;
|
|
||||||
if username="&user" then call symputx('uid',id,'l');
|
|
||||||
run;
|
|
||||||
proc http method='GET' headerin=&fref0 out=&fref1
|
|
||||||
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
||||||
%if &mdebug=1 %then %do;
|
|
||||||
debug level=1;
|
|
||||||
%end;
|
|
||||||
run;
|
|
||||||
%end;
|
%end;
|
||||||
|
run;
|
||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
,mac=ms_getgroups.sas
|
,mac=ms_getgroups.sas
|
||||||
,msg=%str(Issue submitting GET query to SASjsApi/group)
|
,msg=%str(Issue submitting GET query to SASjsApi)
|
||||||
)
|
)
|
||||||
|
|
||||||
libname &libref JSON fileref=&fref1;
|
libname &libref JSON fileref=&fref1;
|
||||||
|
|
||||||
data &outds;
|
%if "&user"="0" %then %do;
|
||||||
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
data &outds;
|
||||||
if _n_=1 then call missing(of _all_);
|
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
||||||
set &libref..root;
|
if _n_=1 then call missing(of _all_);
|
||||||
drop ordinal_root;
|
set &libref..root;
|
||||||
run;
|
drop ordinal_root;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
%else %do;
|
||||||
|
data &outds;
|
||||||
|
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
||||||
|
if _n_=1 then call missing(of _all_);
|
||||||
|
set &libref..groups;
|
||||||
|
drop ordinal_:;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
|
||||||
%mp_abort(
|
%mp_abort(
|
||||||
iftrue=(&syscc ne 0)
|
iftrue=(&syscc ne 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user