@sasjs/core 4.30.3 → 4.31.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/base/mf_getuser.sas +9 -8
- package/base/mp_abort.sas +200 -200
- package/meta/mm_createwebservice.sas +9 -8
- package/meta/mm_getusers.sas +46 -19
- package/package.json +1 -1
- package/server/ms_createwebservice.sas +9 -8
- package/viya/mv_createwebservice.sas +9 -8
package/base/mf_getuser.sas
CHANGED
|
@@ -23,18 +23,19 @@
|
|
|
23
23
|
@author Allan Bowe
|
|
24
24
|
**/
|
|
25
25
|
|
|
26
|
-
%macro mf_getuser(
|
|
26
|
+
%macro mf_getuser(
|
|
27
27
|
)/*/STORE SOURCE*/;
|
|
28
|
-
%local user
|
|
29
|
-
%if &type=OS %then %let metavar=_secureusername;
|
|
30
|
-
%else %let metavar=_metaperson;
|
|
28
|
+
%local user;
|
|
31
29
|
|
|
32
|
-
%if %symexist(
|
|
33
|
-
%else %if %symexist(
|
|
34
|
-
%
|
|
30
|
+
%if %symexist(_sasjs_username) %then %let user=&_sasjs_username;
|
|
31
|
+
%else %if %symexist(SYS_COMPUTE_SESSION_OWNER) %then %do;
|
|
32
|
+
%let user=&SYS_COMPUTE_SESSION_OWNER;
|
|
33
|
+
%end;
|
|
34
|
+
%else %if %symexist(_metaperson) %then %do;
|
|
35
|
+
%if %length(&_metaperson)=0 %then %let user=&sysuserid;
|
|
35
36
|
/* sometimes SAS will add @domain extension - remove for consistency */
|
|
36
37
|
/* but be sure to quote in case of usernames with commas */
|
|
37
|
-
%else %let user=%unquote(%scan(%quote(
|
|
38
|
+
%else %let user=%unquote(%scan(%quote(&_metaperson),1,@));
|
|
38
39
|
%end;
|
|
39
40
|
%else %let user=&sysuserid;
|
|
40
41
|
|
package/base/mp_abort.sas
CHANGED
|
@@ -63,236 +63,236 @@
|
|
|
63
63
|
, mode=REGULAR
|
|
64
64
|
)/*/STORE SOURCE*/;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
%global sysprocessmode sysprocessname sasjs_stpsrv_header_loc sasjsprocessmode;
|
|
67
|
+
%local fref fid i;
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
%if not(%eval(%unquote(&iftrue))) %then %return;
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
%put NOTE: /// mp_abort macro executing //;
|
|
72
|
+
%if %length(&mac)>0 %then %put NOTE- called by &mac;
|
|
73
|
+
%put NOTE - &msg;
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
%if %symexist(_SYSINCLUDEFILEDEVICE)
|
|
76
|
+
/* abort cancel FILE does not restart outside the INCLUDE on Viya 3.5 */
|
|
77
|
+
and %superq(SYSPROCESSNAME) ne %str(Compute Server)
|
|
78
|
+
%then %do;
|
|
79
|
+
%if "*&_SYSINCLUDEFILEDEVICE*" ne "**" %then %do;
|
|
80
|
+
data &errds;
|
|
81
|
+
iftrue='1=1';
|
|
82
|
+
length mac $100 msg $5000;
|
|
83
|
+
mac=symget('mac');
|
|
84
|
+
msg=symget('msg');
|
|
85
|
+
run;
|
|
86
|
+
data _null_;
|
|
87
|
+
abort cancel FILE;
|
|
88
|
+
run;
|
|
89
|
+
%return;
|
|
90
|
+
%end;
|
|
91
|
+
%end;
|
|
92
|
+
|
|
93
|
+
/* Web App Context */
|
|
94
|
+
%if %symexist(_PROGRAM)
|
|
95
|
+
or %superq(SYSPROCESSNAME) = %str(Compute Server)
|
|
96
|
+
or &mode=INCLUDE
|
|
97
|
+
%then %do;
|
|
98
|
+
options obs=max replace mprint;
|
|
99
|
+
%if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5"
|
|
78
100
|
%then %do;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
msg=symget('msg');
|
|
85
|
-
run;
|
|
101
|
+
options nosyntaxcheck;
|
|
102
|
+
%end;
|
|
103
|
+
|
|
104
|
+
%if &mode=INCLUDE %then %do;
|
|
105
|
+
%if %sysfunc(exist(&errds))=1 %then %do;
|
|
86
106
|
data _null_;
|
|
87
|
-
|
|
107
|
+
set &errds;
|
|
108
|
+
call symputx('iftrue',iftrue,'l');
|
|
109
|
+
call symputx('mac',mac,'l');
|
|
110
|
+
call symputx('msg',msg,'l');
|
|
111
|
+
putlog (_all_)(=);
|
|
88
112
|
run;
|
|
113
|
+
%if (&iftrue)=0 %then %return;
|
|
114
|
+
%end;
|
|
115
|
+
%else %do;
|
|
116
|
+
%put &sysmacroname: No include errors found;
|
|
89
117
|
%return;
|
|
90
118
|
%end;
|
|
91
119
|
%end;
|
|
92
120
|
|
|
93
|
-
/*
|
|
94
|
-
%
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
%
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
%put &sysmacroname: No include errors found;
|
|
117
|
-
%return;
|
|
118
|
-
%end;
|
|
119
|
-
%end;
|
|
120
|
-
|
|
121
|
-
/* extract log errs / warns, if exist */
|
|
122
|
-
%local logloc logline;
|
|
123
|
-
%global logmsg; /* capture global messages */
|
|
124
|
-
%if %symexist(SYSPRINTTOLOG) %then %let logloc=&SYSPRINTTOLOG;
|
|
125
|
-
%else %let logloc=%qsysfunc(getoption(LOG));
|
|
126
|
-
proc printto log=log;run;
|
|
127
|
-
%let logline=0;
|
|
128
|
-
%if %length(&logloc)>0 %then %do;
|
|
121
|
+
/* extract log errs / warns, if exist */
|
|
122
|
+
%local logloc logline;
|
|
123
|
+
%global logmsg; /* capture global messages */
|
|
124
|
+
%if %symexist(SYSPRINTTOLOG) %then %let logloc=&SYSPRINTTOLOG;
|
|
125
|
+
%else %let logloc=%qsysfunc(getoption(LOG));
|
|
126
|
+
proc printto log=log;run;
|
|
127
|
+
%let logline=0;
|
|
128
|
+
%if %length(&logloc)>0 %then %do;
|
|
129
|
+
data _null_;
|
|
130
|
+
infile &logloc lrecl=5000;
|
|
131
|
+
input; putlog _infile_;
|
|
132
|
+
i=1;
|
|
133
|
+
retain logonce 0;
|
|
134
|
+
if (
|
|
135
|
+
_infile_=:"%str(WARN)ING" or _infile_=:"%str(ERR)OR"
|
|
136
|
+
) and logonce=0 then
|
|
137
|
+
do;
|
|
138
|
+
call symputx('logline',_n_);
|
|
139
|
+
logonce+1;
|
|
140
|
+
end;
|
|
141
|
+
run;
|
|
142
|
+
/* capture log including lines BEFORE the err */
|
|
143
|
+
%if &logline>0 %then %do;
|
|
129
144
|
data _null_;
|
|
130
145
|
infile &logloc lrecl=5000;
|
|
131
|
-
input;
|
|
146
|
+
input;
|
|
132
147
|
i=1;
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
logonce+1;
|
|
148
|
+
stoploop=0;
|
|
149
|
+
if _n_ ge &logline-15 and stoploop=0 then do until (i>22);
|
|
150
|
+
call symputx('logmsg',catx('\n',symget('logmsg'),_infile_));
|
|
151
|
+
input;
|
|
152
|
+
i+1;
|
|
153
|
+
stoploop=1;
|
|
140
154
|
end;
|
|
155
|
+
if stoploop=1 then stop;
|
|
141
156
|
run;
|
|
142
|
-
/* capture log including lines BEFORE the err */
|
|
143
|
-
%if &logline>0 %then %do;
|
|
144
|
-
data _null_;
|
|
145
|
-
infile &logloc lrecl=5000;
|
|
146
|
-
input;
|
|
147
|
-
i=1;
|
|
148
|
-
stoploop=0;
|
|
149
|
-
if _n_ ge &logline-15 and stoploop=0 then do until (i>22);
|
|
150
|
-
call symputx('logmsg',catx('\n',symget('logmsg'),_infile_));
|
|
151
|
-
input;
|
|
152
|
-
i+1;
|
|
153
|
-
stoploop=1;
|
|
154
|
-
end;
|
|
155
|
-
if stoploop=1 then stop;
|
|
156
|
-
run;
|
|
157
|
-
%end;
|
|
158
157
|
%end;
|
|
158
|
+
%end;
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
%end;
|
|
166
|
-
%else %do;
|
|
167
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
168
|
-
name="_webout.json" lrecl=999999 mod;
|
|
169
|
-
%end;
|
|
160
|
+
%if %symexist(SYS_JES_JOB_URI) %then %do;
|
|
161
|
+
/* setup webout for Viya */
|
|
162
|
+
options nobomfile;
|
|
163
|
+
%if "X&SYS_JES_JOB_URI.X"="XX" %then %do;
|
|
164
|
+
filename _webout temp lrecl=999999 mod;
|
|
170
165
|
%end;
|
|
171
|
-
%else %
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
%let fid=%sysfunc(fopen(&fref,A));
|
|
175
|
-
%if &fid=0 %then %do;
|
|
176
|
-
%put %str(ERR)OR: %sysfunc(sysmsg());
|
|
177
|
-
%return;
|
|
178
|
-
%end;
|
|
179
|
-
%let rc=%sysfunc(fput(&fid,%str(Content-Type: application/json)));
|
|
180
|
-
%let rc=%sysfunc(fwrite(&fid));
|
|
181
|
-
%let rc=%sysfunc(fclose(&fid));
|
|
182
|
-
%let rc=%sysfunc(filename(&fref));
|
|
166
|
+
%else %do;
|
|
167
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
168
|
+
name="_webout.json" lrecl=999999 mod;
|
|
183
169
|
%end;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
msg=cats(msg,'\n\nLog Extract:\n',symget('logmsg'));
|
|
170
|
+
%end;
|
|
171
|
+
%else %if %sysfunc(filename(fref,&sasjs_stpsrv_header_loc))=0 %then %do;
|
|
172
|
+
options nobomfile;
|
|
173
|
+
/* set up http header for SASjs Server */
|
|
174
|
+
%let fid=%sysfunc(fopen(&fref,A));
|
|
175
|
+
%if &fid=0 %then %do;
|
|
176
|
+
%put %str(ERR)OR: %sysfunc(sysmsg());
|
|
177
|
+
%return;
|
|
193
178
|
%end;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
msg=compress(msg,,'kw');
|
|
200
|
-
/* quote without quoting the quotes (which are escaped instead) */
|
|
201
|
-
msg=cats('"',msg,'"');
|
|
202
|
-
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
|
203
|
-
else debug='""';
|
|
204
|
-
if symget('sasjsprocessmode')='Stored Program' then mode='SASJS';
|
|
205
|
-
if mode ne 'SASJS' then put '>>weboutBEGIN<<';
|
|
206
|
-
put '{"SYSDATE" : "' "&SYSDATE" '"';
|
|
207
|
-
put ',"SYSTIME" : "' "&SYSTIME" '"';
|
|
208
|
-
put ',"sasjsAbort" : [{';
|
|
209
|
-
put ' "MSG":' msg ;
|
|
210
|
-
put ' ,"MAC": "' "&mac" '"}]';
|
|
211
|
-
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
|
212
|
-
put ',"_DEBUG":' debug ;
|
|
213
|
-
if symexist('_metauser') then do;
|
|
214
|
-
_METAUSER=quote(trim(symget('_METAUSER')));
|
|
215
|
-
put ",""_METAUSER"": " _METAUSER;
|
|
216
|
-
_METAPERSON=quote(trim(symget('_METAPERSON')));
|
|
217
|
-
put ',"_METAPERSON": ' _METAPERSON;
|
|
218
|
-
end;
|
|
219
|
-
if symexist('SYS_JES_JOB_URI') then do;
|
|
220
|
-
SYS_JES_JOB_URI=quote(trim(symget('SYS_JES_JOB_URI')));
|
|
221
|
-
put ',"SYS_JES_JOB_URI": ' SYS_JES_JOB_URI;
|
|
222
|
-
end;
|
|
223
|
-
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
|
224
|
-
put ',"_PROGRAM" : ' _PROGRAM ;
|
|
225
|
-
put ",""SYSCC"" : ""&syscc"" ";
|
|
226
|
-
syserrortext=quote(trim(symget('syserrortext')));
|
|
227
|
-
put ",""SYSERRORTEXT"" : " syserrortext;
|
|
228
|
-
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
|
229
|
-
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
|
230
|
-
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
|
231
|
-
put ",""SYSSITE"" : ""&syssite"" ";
|
|
232
|
-
sysvlong=quote(trim(symget('sysvlong')));
|
|
233
|
-
put ',"SYSVLONG" : ' sysvlong;
|
|
234
|
-
syswarningtext=quote(trim(symget('syswarningtext')));
|
|
235
|
-
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
|
236
|
-
put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" ';
|
|
237
|
-
put "}" ;
|
|
238
|
-
if mode ne 'SASJS' then put '>>weboutEND<<';
|
|
239
|
-
run;
|
|
179
|
+
%let rc=%sysfunc(fput(&fid,%str(Content-Type: application/json)));
|
|
180
|
+
%let rc=%sysfunc(fwrite(&fid));
|
|
181
|
+
%let rc=%sysfunc(fclose(&fid));
|
|
182
|
+
%let rc=%sysfunc(filename(&fref));
|
|
183
|
+
%end;
|
|
240
184
|
|
|
241
|
-
|
|
185
|
+
/* send response in SASjs JSON format */
|
|
186
|
+
data _null_;
|
|
187
|
+
file _webout mod lrecl=32000 encoding='utf-8';
|
|
188
|
+
length msg syswarningtext syserrortext $32767 mode $10 ;
|
|
189
|
+
sasdatetime=datetime();
|
|
190
|
+
msg=symget('msg');
|
|
191
|
+
%if &logline>0 %then %do;
|
|
192
|
+
msg=cats(msg,'\n\nLog Extract:\n',symget('logmsg'));
|
|
193
|
+
%end;
|
|
194
|
+
/* escape the escapes */
|
|
195
|
+
msg=tranwrd(msg,'\','\\');
|
|
196
|
+
/* escape the quotes */
|
|
197
|
+
msg=tranwrd(msg,'"','\"');
|
|
198
|
+
/* ditch the CRLFs as chrome complains */
|
|
199
|
+
msg=compress(msg,,'kw');
|
|
200
|
+
/* quote without quoting the quotes (which are escaped instead) */
|
|
201
|
+
msg=cats('"',msg,'"');
|
|
202
|
+
if symexist('_debug') then debug=quote(trim(symget('_debug')));
|
|
203
|
+
else debug='""';
|
|
204
|
+
if symget('sasjsprocessmode')='Stored Program' then mode='SASJS';
|
|
205
|
+
if mode ne 'SASJS' then put '>>weboutBEGIN<<';
|
|
206
|
+
put '{"SYSDATE" : "' "&SYSDATE" '"';
|
|
207
|
+
put ',"SYSTIME" : "' "&SYSTIME" '"';
|
|
208
|
+
put ',"sasjsAbort" : [{';
|
|
209
|
+
put ' "MSG":' msg ;
|
|
210
|
+
put ' ,"MAC": "' "&mac" '"}]';
|
|
211
|
+
put ",""SYSUSERID"" : ""&sysuserid"" ";
|
|
212
|
+
put ',"_DEBUG":' debug ;
|
|
213
|
+
if symexist('_metauser') then do;
|
|
214
|
+
_METAUSER=quote(trim(symget('_METAUSER')));
|
|
215
|
+
put ",""_METAUSER"": " _METAUSER;
|
|
216
|
+
_METAPERSON=quote(trim(symget('_METAPERSON')));
|
|
217
|
+
put ',"_METAPERSON": ' _METAPERSON;
|
|
218
|
+
end;
|
|
219
|
+
if symexist('SYS_JES_JOB_URI') then do;
|
|
220
|
+
SYS_JES_JOB_URI=quote(trim(symget('SYS_JES_JOB_URI')));
|
|
221
|
+
put ',"SYS_JES_JOB_URI": ' SYS_JES_JOB_URI;
|
|
222
|
+
end;
|
|
223
|
+
_PROGRAM=quote(trim(resolve(symget('_PROGRAM'))));
|
|
224
|
+
put ',"_PROGRAM" : ' _PROGRAM ;
|
|
225
|
+
put ",""SYSCC"" : ""&syscc"" ";
|
|
226
|
+
syserrortext=quote(trim(symget('syserrortext')));
|
|
227
|
+
put ",""SYSERRORTEXT"" : " syserrortext;
|
|
228
|
+
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
|
229
|
+
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
|
230
|
+
put ",""SYSSCPL"" : ""&sysscpl"" ";
|
|
231
|
+
put ",""SYSSITE"" : ""&syssite"" ";
|
|
232
|
+
sysvlong=quote(trim(symget('sysvlong')));
|
|
233
|
+
put ',"SYSVLONG" : ' sysvlong;
|
|
234
|
+
syswarningtext=quote(trim(symget('syswarningtext')));
|
|
235
|
+
put ",""SYSWARNINGTEXT"" : " syswarningtext;
|
|
236
|
+
put ',"END_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '" ';
|
|
237
|
+
put "}" ;
|
|
238
|
+
if mode ne 'SASJS' then put '>>weboutEND<<';
|
|
239
|
+
run;
|
|
242
240
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* endsas kills 9.4m3 deployments by orphaning multibridges.
|
|
258
|
-
* Abort variants are ungraceful (non zero return code)
|
|
259
|
-
* This approach lets SAS run silently until the end :-)
|
|
260
|
-
* Caution - fails when called within a %include within a macro
|
|
261
|
-
* Use mp_include() to handle this.
|
|
262
|
-
*/
|
|
263
|
-
filename skip temp;
|
|
264
|
-
data _null_;
|
|
265
|
-
file skip;
|
|
266
|
-
put '%macro skip();';
|
|
267
|
-
comment '%mend skip; -> fix lint ';
|
|
268
|
-
put '%macro skippy();';
|
|
269
|
-
comment '%mend skippy; -> fix lint ';
|
|
270
|
-
run;
|
|
271
|
-
%inc skip;
|
|
272
|
-
%end;
|
|
241
|
+
%put _all_;
|
|
242
|
+
|
|
243
|
+
%if "&sysprocessmode " = "SAS Stored Process Server " %then %do;
|
|
244
|
+
data _null_;
|
|
245
|
+
putlog 'stpsrvset program err and syscc';
|
|
246
|
+
rc=stpsrvset('program error', 0);
|
|
247
|
+
call symputx("syscc",0,"g");
|
|
248
|
+
run;
|
|
249
|
+
%if &sysscp=WIN
|
|
250
|
+
and "%substr(%str(&sysvlong ),1,8)"="9.04.01M"
|
|
251
|
+
and "%substr(%str(&sysvlong ),9,1)">"5" %then %do;
|
|
252
|
+
/* skip approach (below) does not work in windows m6+ envs */
|
|
253
|
+
endsas;
|
|
273
254
|
%end;
|
|
274
|
-
%else %
|
|
275
|
-
|
|
255
|
+
%else %do;
|
|
256
|
+
/**
|
|
257
|
+
* endsas kills 9.4m3 deployments by orphaning multibridges.
|
|
258
|
+
* Abort variants are ungraceful (non zero return code)
|
|
259
|
+
* This approach lets SAS run silently until the end :-)
|
|
260
|
+
* Caution - fails when called within a %include within a macro
|
|
261
|
+
* Use mp_include() to handle this.
|
|
262
|
+
*/
|
|
263
|
+
filename skip temp;
|
|
276
264
|
data _null_;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
iftrue=symget('iftrue');
|
|
283
|
-
put (_all_)(/=);
|
|
284
|
-
call symputx('syscc',0);
|
|
285
|
-
abort cancel nolist;
|
|
265
|
+
file skip;
|
|
266
|
+
put '%macro skip();';
|
|
267
|
+
comment '%mend skip; -> fix lint ';
|
|
268
|
+
put '%macro skippy();';
|
|
269
|
+
comment '%mend skippy; -> fix lint ';
|
|
286
270
|
run;
|
|
271
|
+
%inc skip;
|
|
287
272
|
%end;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
273
|
+
%end;
|
|
274
|
+
%else %if "&sysprocessmode " = "SAS Compute Server " %then %do;
|
|
275
|
+
/* endsas kills the session making it harder to fetch results */
|
|
276
|
+
data _null_;
|
|
277
|
+
syswarningtext=symget('syswarningtext');
|
|
278
|
+
syserrortext=symget('syserrortext');
|
|
279
|
+
abort_msg=symget('msg');
|
|
280
|
+
syscc=symget('syscc');
|
|
281
|
+
sysuserid=symget('sysuserid');
|
|
282
|
+
iftrue=symget('iftrue');
|
|
283
|
+
put (_all_)(/=);
|
|
284
|
+
call symputx('syscc',0);
|
|
285
|
+
abort cancel nolist;
|
|
286
|
+
run;
|
|
291
287
|
%end;
|
|
292
288
|
%else %do;
|
|
293
|
-
%put _all_;
|
|
294
289
|
%abort cancel;
|
|
295
290
|
%end;
|
|
291
|
+
%end;
|
|
292
|
+
%else %do;
|
|
293
|
+
%put _all_;
|
|
294
|
+
%abort cancel;
|
|
295
|
+
%end;
|
|
296
296
|
%mend mp_abort;
|
|
297
297
|
|
|
298
298
|
/** @endcond */
|
|
@@ -315,18 +315,19 @@ data _null_;
|
|
|
315
315
|
put '%end; ';
|
|
316
316
|
put '%mend mp_jsonout; ';
|
|
317
317
|
put ' ';
|
|
318
|
-
put '%macro mf_getuser(
|
|
318
|
+
put '%macro mf_getuser( ';
|
|
319
319
|
put ')/*/STORE SOURCE*/; ';
|
|
320
|
-
put ' %local user
|
|
321
|
-
put ' %if &type=OS %then %let metavar=_secureusername; ';
|
|
322
|
-
put ' %else %let metavar=_metaperson; ';
|
|
320
|
+
put ' %local user; ';
|
|
323
321
|
put ' ';
|
|
324
|
-
put ' %if %symexist(
|
|
325
|
-
put ' %else %if %symexist(
|
|
326
|
-
put ' %
|
|
322
|
+
put ' %if %symexist(_sasjs_username) %then %let user=&_sasjs_username; ';
|
|
323
|
+
put ' %else %if %symexist(SYS_COMPUTE_SESSION_OWNER) %then %do; ';
|
|
324
|
+
put ' %let user=&SYS_COMPUTE_SESSION_OWNER; ';
|
|
325
|
+
put ' %end; ';
|
|
326
|
+
put ' %else %if %symexist(_metaperson) %then %do; ';
|
|
327
|
+
put ' %if %length(&_metaperson)=0 %then %let user=&sysuserid; ';
|
|
327
328
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
|
328
329
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
|
329
|
-
put ' %else %let user=%unquote(%scan(%quote(
|
|
330
|
+
put ' %else %let user=%unquote(%scan(%quote(&_metaperson),1,@)); ';
|
|
330
331
|
put ' %end; ';
|
|
331
332
|
put ' %else %let user=&sysuserid; ';
|
|
332
333
|
put ' ';
|
package/meta/mm_getusers.sas
CHANGED
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
%mm_getusers()
|
|
10
10
|
|
|
11
|
+
Optionally, filter for a user (useful to get the uri):
|
|
12
|
+
|
|
13
|
+
%mm_getusers(user=&_metaperson)
|
|
14
|
+
|
|
11
15
|
@param outds the dataset to create that contains the list of libraries
|
|
12
16
|
|
|
13
17
|
@returns outds dataset containing all users, with the following columns:
|
|
14
18
|
- uri
|
|
15
19
|
- name
|
|
16
20
|
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
filename sxlemap clear;
|
|
20
|
-
filename response clear;
|
|
21
|
-
libname _XML_ clear;
|
|
21
|
+
@param user= (0) Set to a metadata user to filter on that user
|
|
22
|
+
@param outds= (work.mm_getusers) The output table to create
|
|
22
23
|
|
|
23
24
|
@version 9.3
|
|
24
25
|
@author Allan Bowe
|
|
@@ -26,23 +27,49 @@
|
|
|
26
27
|
**/
|
|
27
28
|
|
|
28
29
|
%macro mm_getusers(
|
|
29
|
-
outds=work.mm_getusers
|
|
30
|
+
outds=work.mm_getusers,
|
|
31
|
+
user=0
|
|
30
32
|
)/*/STORE SOURCE*/;
|
|
31
33
|
|
|
32
34
|
filename response temp;
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
%if %superq(user)=0 %then %do;
|
|
36
|
+
proc metadata in= '<GetMetadataObjects>
|
|
37
|
+
<Reposid>$METAREPOSITORY</Reposid>
|
|
38
|
+
<Type>Person</Type>
|
|
39
|
+
<NS>SAS</NS>
|
|
40
|
+
<Flags>0</Flags>
|
|
41
|
+
<Options>
|
|
42
|
+
<Templates>
|
|
43
|
+
<Person Name=""/>
|
|
44
|
+
</Templates>
|
|
45
|
+
</Options>
|
|
46
|
+
</GetMetadataObjects>'
|
|
47
|
+
out=response;
|
|
48
|
+
run;
|
|
49
|
+
%end;
|
|
50
|
+
%else %do;
|
|
51
|
+
filename inref temp;
|
|
52
|
+
data _null_;
|
|
53
|
+
file inref;
|
|
54
|
+
put "<GetMetadataObjects>";
|
|
55
|
+
put "<Reposid>$METAREPOSITORY</Reposid>";
|
|
56
|
+
put "<Type>Person</Type>";
|
|
57
|
+
put "<NS>SAS</NS>";
|
|
58
|
+
put "<!-- Specify the OMI_XMLSELECT (128) flag -->";
|
|
59
|
+
put "<Flags>128</Flags>";
|
|
60
|
+
put "<Options>";
|
|
61
|
+
put "<Templates>";
|
|
62
|
+
put '<Person Name=""/>';
|
|
63
|
+
put "</Templates>";
|
|
64
|
+
length string $10000;
|
|
65
|
+
string=cats('<XMLSELECT search="Person[@Name=',"'&user'",']"/>');
|
|
66
|
+
put string;
|
|
67
|
+
put "</Options>";
|
|
68
|
+
put "</GetMetadataObjects>";
|
|
69
|
+
run;
|
|
70
|
+
proc metadata in=inref out=response;
|
|
71
|
+
run;
|
|
72
|
+
%end;
|
|
46
73
|
|
|
47
74
|
filename sxlemap temp;
|
|
48
75
|
data _null_;
|
package/package.json
CHANGED
|
@@ -317,18 +317,19 @@ data _null_;
|
|
|
317
317
|
put '%end; ';
|
|
318
318
|
put '%mend mp_jsonout; ';
|
|
319
319
|
put ' ';
|
|
320
|
-
put '%macro mf_getuser(
|
|
320
|
+
put '%macro mf_getuser( ';
|
|
321
321
|
put ')/*/STORE SOURCE*/; ';
|
|
322
|
-
put ' %local user
|
|
323
|
-
put ' %if &type=OS %then %let metavar=_secureusername; ';
|
|
324
|
-
put ' %else %let metavar=_metaperson; ';
|
|
322
|
+
put ' %local user; ';
|
|
325
323
|
put ' ';
|
|
326
|
-
put ' %if %symexist(
|
|
327
|
-
put ' %else %if %symexist(
|
|
328
|
-
put ' %
|
|
324
|
+
put ' %if %symexist(_sasjs_username) %then %let user=&_sasjs_username; ';
|
|
325
|
+
put ' %else %if %symexist(SYS_COMPUTE_SESSION_OWNER) %then %do; ';
|
|
326
|
+
put ' %let user=&SYS_COMPUTE_SESSION_OWNER; ';
|
|
327
|
+
put ' %end; ';
|
|
328
|
+
put ' %else %if %symexist(_metaperson) %then %do; ';
|
|
329
|
+
put ' %if %length(&_metaperson)=0 %then %let user=&sysuserid; ';
|
|
329
330
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
|
330
331
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
|
331
|
-
put ' %else %let user=%unquote(%scan(%quote(
|
|
332
|
+
put ' %else %let user=%unquote(%scan(%quote(&_metaperson),1,@)); ';
|
|
332
333
|
put ' %end; ';
|
|
333
334
|
put ' %else %let user=&sysuserid; ';
|
|
334
335
|
put ' ';
|
|
@@ -459,18 +459,19 @@ data _null_;
|
|
|
459
459
|
put '%end; ';
|
|
460
460
|
put '%mend mp_jsonout; ';
|
|
461
461
|
put ' ';
|
|
462
|
-
put '%macro mf_getuser(
|
|
462
|
+
put '%macro mf_getuser( ';
|
|
463
463
|
put ')/*/STORE SOURCE*/; ';
|
|
464
|
-
put ' %local user
|
|
465
|
-
put ' %if &type=OS %then %let metavar=_secureusername; ';
|
|
466
|
-
put ' %else %let metavar=_metaperson; ';
|
|
464
|
+
put ' %local user; ';
|
|
467
465
|
put ' ';
|
|
468
|
-
put ' %if %symexist(
|
|
469
|
-
put ' %else %if %symexist(
|
|
470
|
-
put ' %
|
|
466
|
+
put ' %if %symexist(_sasjs_username) %then %let user=&_sasjs_username; ';
|
|
467
|
+
put ' %else %if %symexist(SYS_COMPUTE_SESSION_OWNER) %then %do; ';
|
|
468
|
+
put ' %let user=&SYS_COMPUTE_SESSION_OWNER; ';
|
|
469
|
+
put ' %end; ';
|
|
470
|
+
put ' %else %if %symexist(_metaperson) %then %do; ';
|
|
471
|
+
put ' %if %length(&_metaperson)=0 %then %let user=&sysuserid; ';
|
|
471
472
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
|
472
473
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
|
473
|
-
put ' %else %let user=%unquote(%scan(%quote(
|
|
474
|
+
put ' %else %let user=%unquote(%scan(%quote(&_metaperson),1,@)); ';
|
|
474
475
|
put ' %end; ';
|
|
475
476
|
put ' %else %let user=&sysuserid; ';
|
|
476
477
|
put ' ';
|