mirror of
https://github.com/sasjs/core.git
synced 2025-12-12 06:54:35 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b884d165f | ||
|
|
5a2968e798 | ||
|
|
120ad9a7da | ||
|
|
67a81b2690 | ||
|
|
506cf1812f | ||
|
|
8cc0eb0dd7 | ||
|
|
3f49925d01 | ||
|
|
c51c9c2ca9 |
144
all.sas
144
all.sas
@@ -9041,7 +9041,7 @@ data _null_;
|
||||
put '%local i tempds jsonengine; ';
|
||||
put ' ';
|
||||
put '/* see https://github.com/sasjs/core/issues/41 */ ';
|
||||
put '%if %upcase(&SYSENCODING)=WLATIN1 %then %let jsonengine=PROCJSON; ';
|
||||
put '%if "%upcase(&SYSENCODING)" ne "UTF-8" %then %let jsonengine=PROCJSON; ';
|
||||
put '%else %let jsonengine=DATASTEP; ';
|
||||
put ' ';
|
||||
put ' ';
|
||||
@@ -11769,7 +11769,8 @@ filename __shake clear;
|
||||
put '%let mmxpass="Mars321";';
|
||||
run;
|
||||
|
||||
filename myref "%sysfunc(pathname(work))/mmxexport.sh";
|
||||
filename myref "%sysfunc(pathname(work))/mmxexport.sh"
|
||||
permission='A::u::rwx,A::g::r-x,A::o::---';
|
||||
%mm_spkexport(metaloc=%str(/my/meta/loc)
|
||||
,outref=myref
|
||||
,secureref=tmp
|
||||
@@ -11778,7 +11779,8 @@ filename __shake clear;
|
||||
|
||||
Alternatively, call without inputs to create a function style output
|
||||
|
||||
filename myref "/tmp/mmscript.sh";
|
||||
filename myref "/tmp/mmscript.sh"
|
||||
permission='A::u::rwx,A::g::r-x,A::o::---';
|
||||
%mm_spkexport(metaloc=%str(/my/meta/loc)
|
||||
outref=myref
|
||||
,cmdoutloc=%str(/tmp)
|
||||
@@ -11864,7 +11866,7 @@ run;
|
||||
,msg=%str(syscc=&syscc)
|
||||
)
|
||||
|
||||
%mend;/**
|
||||
%mend mm_spkexport;/**
|
||||
@file mm_tree.sas
|
||||
@brief Returns all folders / subfolder content for a particular root
|
||||
@details Shows all members and SubTrees for a particular root.
|
||||
@@ -12532,7 +12534,7 @@ run;
|
||||
%local i tempds jsonengine;
|
||||
|
||||
/* see https://github.com/sasjs/core/issues/41 */
|
||||
%if %upcase(&SYSENCODING)=WLATIN1 %then %let jsonengine=PROCJSON;
|
||||
%if "%upcase(&SYSENCODING)" ne "UTF-8" %then %let jsonengine=PROCJSON;
|
||||
%else %let jsonengine=DATASTEP;
|
||||
|
||||
|
||||
@@ -12701,6 +12703,98 @@ data _null_;
|
||||
run;
|
||||
|
||||
%mend;/**
|
||||
@file
|
||||
@brief Get metadata permissions for a particular folder
|
||||
@details Uses the metadata batch tools to fetch the permissions for a
|
||||
particular folder. For security, the username / password are expected to have
|
||||
been provided in a protected directory.
|
||||
|
||||
Usage:
|
||||
|
||||
%* import the macros (or make them available some other way);
|
||||
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
||||
%inc mc;
|
||||
|
||||
%* create sample text file as input to the macro;
|
||||
%* password must be in single quotes if it has special chars;
|
||||
|
||||
filename creds temp;
|
||||
data _null_;
|
||||
file creds;
|
||||
put " -user 'sasdemo' -password 'Mars321' ";
|
||||
run;
|
||||
|
||||
filename outref "%sysfunc(pathname(work))";
|
||||
%mmx_getmetaperms(
|
||||
metaloc=/some/meta/folder
|
||||
,secureref=creds
|
||||
,outds=work.perms
|
||||
)
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_loc.sas
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mp_abort.sas
|
||||
|
||||
@param metaloc= the metadata folder for which to export permissions
|
||||
@param secureref= fileref containing the username / password (should point to
|
||||
a file in a secure location)
|
||||
@param outds= (work.mmx_getmetaperms) The output table containing the perms
|
||||
@param effective= (YES) Displays effective access. If set to NO, only direct
|
||||
access controls are displayed. Effective access is the net effect of all
|
||||
applicable permission settings (both direct access controls and inherited
|
||||
permissions).
|
||||
@param onlyGroup= (0) Display access for only the specified user group.
|
||||
@param onlyUser= (0) Display access for only the specified user.
|
||||
|
||||
@version 9.4
|
||||
@author Allan Bowe
|
||||
|
||||
**/
|
||||
|
||||
%macro mmx_getmetaperms(metaloc=
|
||||
,secureref=
|
||||
,outds=work.mmx_getmetaperms
|
||||
,effective=YES
|
||||
,onlygroup=0
|
||||
,onlyuser=0
|
||||
);
|
||||
|
||||
%local host port path mmxuser mmxpass eff filt;
|
||||
%let host=%sysfunc(getoption(metaserver));
|
||||
%let port=%sysfunc(getoption(metaport));
|
||||
%let path=%mf_loc(POF)/tools/sas-show-metadata-access;
|
||||
|
||||
%if &effective=YES %then %let eff=-effective;
|
||||
%if "&onlygroup" ne "0" %then %let filt=-onlyGroup ""&onlygroup"";
|
||||
%else %if "&onlyuser" ne "0" %then %let filt=-onlyUser ""&onlyuser"";
|
||||
|
||||
%local fref1;
|
||||
%let fref1=%mf_getuniquefileref();
|
||||
data _null_;
|
||||
file &fref1 lrecl=32767;
|
||||
infile &secureref;
|
||||
input;
|
||||
put 'data _null_;';
|
||||
put "infile '&path -disableX11 -host &host -port &port " _infile_ @;
|
||||
put " ""&metaloc"" &eff &filt 2>&1' pipe lrecl=10000;";
|
||||
put 'input;putlog _infile_;run;';
|
||||
run;
|
||||
|
||||
data _null_;
|
||||
infile &fref1;
|
||||
input;list;run;
|
||||
|
||||
%inc &fref1/nosource;
|
||||
|
||||
|
||||
%mp_abort(iftrue= (&syscc ne 0)
|
||||
,mac=&sysmacroname
|
||||
,msg=%str(syscc=&syscc on exit)
|
||||
)
|
||||
|
||||
|
||||
%mend mmx_getmetaperms;/**
|
||||
@file mmx_spkexport.sas
|
||||
@brief Exports everything in a particular metadata folder
|
||||
@details Will export everything in a metadata folder to a specified location.
|
||||
@@ -13423,6 +13517,30 @@ run;
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='01'x then do; /* Unprintable */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='07'x then do; /* Bell Char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'7');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='1B'x then do; /* escape char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'B');rc =fwrite(fileid);
|
||||
end;
|
||||
else do;
|
||||
rc =fput(fileid,rec);
|
||||
rc =fwrite(fileid);
|
||||
@@ -14168,6 +14286,22 @@ run;
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='07'x then do; /* Bell Char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'7');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='1B'x then do; /* escape char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'B');rc =fwrite(fileid);
|
||||
end;
|
||||
else do;
|
||||
rc =fput(fileid,rec);
|
||||
rc =fwrite(fileid);
|
||||
|
||||
@@ -269,7 +269,7 @@ data _null_;
|
||||
put '%local i tempds jsonengine; ';
|
||||
put ' ';
|
||||
put '/* see https://github.com/sasjs/core/issues/41 */ ';
|
||||
put '%if %upcase(&SYSENCODING)=WLATIN1 %then %let jsonengine=PROCJSON; ';
|
||||
put '%if "%upcase(&SYSENCODING)" ne "UTF-8" %then %let jsonengine=PROCJSON; ';
|
||||
put '%else %let jsonengine=DATASTEP; ';
|
||||
put ' ';
|
||||
put ' ';
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
put '%let mmxpass="Mars321";';
|
||||
run;
|
||||
|
||||
filename myref "%sysfunc(pathname(work))/mmxexport.sh";
|
||||
filename myref "%sysfunc(pathname(work))/mmxexport.sh"
|
||||
permission='A::u::rwx,A::g::r-x,A::o::---';
|
||||
%mm_spkexport(metaloc=%str(/my/meta/loc)
|
||||
,outref=myref
|
||||
,secureref=tmp
|
||||
@@ -33,7 +34,8 @@
|
||||
|
||||
Alternatively, call without inputs to create a function style output
|
||||
|
||||
filename myref "/tmp/mmscript.sh";
|
||||
filename myref "/tmp/mmscript.sh"
|
||||
permission='A::u::rwx,A::g::r-x,A::o::---';
|
||||
%mm_spkexport(metaloc=%str(/my/meta/loc)
|
||||
outref=myref
|
||||
,cmdoutloc=%str(/tmp)
|
||||
@@ -119,4 +121,4 @@ run;
|
||||
,msg=%str(syscc=&syscc)
|
||||
)
|
||||
|
||||
%mend;
|
||||
%mend mm_spkexport;
|
||||
@@ -39,7 +39,7 @@
|
||||
%local i tempds jsonengine;
|
||||
|
||||
/* see https://github.com/sasjs/core/issues/41 */
|
||||
%if %upcase(&SYSENCODING)=WLATIN1 %then %let jsonengine=PROCJSON;
|
||||
%if "%upcase(&SYSENCODING)" ne "UTF-8" %then %let jsonengine=PROCJSON;
|
||||
%else %let jsonengine=DATASTEP;
|
||||
|
||||
|
||||
|
||||
93
metax/mmx_getmetaperms.sas
Normal file
93
metax/mmx_getmetaperms.sas
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
@file
|
||||
@brief Get metadata permissions for a particular folder
|
||||
@details Uses the metadata batch tools to fetch the permissions for a
|
||||
particular folder. For security, the username / password are expected to have
|
||||
been provided in a protected directory.
|
||||
|
||||
Usage:
|
||||
|
||||
%* import the macros (or make them available some other way);
|
||||
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
||||
%inc mc;
|
||||
|
||||
%* create sample text file as input to the macro;
|
||||
%* password must be in single quotes if it has special chars;
|
||||
|
||||
filename creds temp;
|
||||
data _null_;
|
||||
file creds;
|
||||
put " -user 'sasdemo' -password 'Mars321' ";
|
||||
run;
|
||||
|
||||
filename outref "%sysfunc(pathname(work))";
|
||||
%mmx_getmetaperms(
|
||||
metaloc=/some/meta/folder
|
||||
,secureref=creds
|
||||
,outds=work.perms
|
||||
)
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_loc.sas
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mp_abort.sas
|
||||
|
||||
@param metaloc= the metadata folder for which to export permissions
|
||||
@param secureref= fileref containing the username / password (should point to
|
||||
a file in a secure location)
|
||||
@param outds= (work.mmx_getmetaperms) The output table containing the perms
|
||||
@param effective= (YES) Displays effective access. If set to NO, only direct
|
||||
access controls are displayed. Effective access is the net effect of all
|
||||
applicable permission settings (both direct access controls and inherited
|
||||
permissions).
|
||||
@param onlyGroup= (0) Display access for only the specified user group.
|
||||
@param onlyUser= (0) Display access for only the specified user.
|
||||
|
||||
@version 9.4
|
||||
@author Allan Bowe
|
||||
|
||||
**/
|
||||
|
||||
%macro mmx_getmetaperms(metaloc=
|
||||
,secureref=
|
||||
,outds=work.mmx_getmetaperms
|
||||
,effective=YES
|
||||
,onlygroup=0
|
||||
,onlyuser=0
|
||||
);
|
||||
|
||||
%local host port path mmxuser mmxpass eff filt;
|
||||
%let host=%sysfunc(getoption(metaserver));
|
||||
%let port=%sysfunc(getoption(metaport));
|
||||
%let path=%mf_loc(POF)/tools/sas-show-metadata-access;
|
||||
|
||||
%if &effective=YES %then %let eff=-effective;
|
||||
%if "&onlygroup" ne "0" %then %let filt=-onlyGroup ""&onlygroup"";
|
||||
%else %if "&onlyuser" ne "0" %then %let filt=-onlyUser ""&onlyuser"";
|
||||
|
||||
%local fref1;
|
||||
%let fref1=%mf_getuniquefileref();
|
||||
data _null_;
|
||||
file &fref1 lrecl=32767;
|
||||
infile &secureref;
|
||||
input;
|
||||
put 'data _null_;';
|
||||
put "infile '&path -disableX11 -host &host -port &port " _infile_ @;
|
||||
put " ""&metaloc"" &eff &filt 2>&1' pipe lrecl=10000;";
|
||||
put 'input;putlog _infile_;run;';
|
||||
run;
|
||||
|
||||
data _null_;
|
||||
infile &fref1;
|
||||
input;list;run;
|
||||
|
||||
%inc &fref1/nosource;
|
||||
|
||||
|
||||
%mp_abort(iftrue= (&syscc ne 0)
|
||||
,mac=&sysmacroname
|
||||
,msg=%str(syscc=&syscc on exit)
|
||||
)
|
||||
|
||||
|
||||
%mend mmx_getmetaperms;
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1579,9 +1579,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.4.5",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz",
|
||||
"integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==",
|
||||
"version": "7.4.6",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
|
||||
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
|
||||
"dev": true
|
||||
},
|
||||
"xml-name-validator": {
|
||||
|
||||
@@ -30,13 +30,16 @@
|
||||
"name": "viya",
|
||||
"serverUrl": "https://sas.analytium.co.uk",
|
||||
"serverType": "SASVIYA",
|
||||
"allowInsecureRequests": false,
|
||||
"appLoc": "/Public/temp/macrocore",
|
||||
"deployConfig": {
|
||||
"deployServicePack": true
|
||||
},
|
||||
"macroFolders": [
|
||||
"tests/viya"
|
||||
],
|
||||
"programFolders": [],
|
||||
"deployConfig": {
|
||||
"deployServicePack": true,
|
||||
"deployScripts": []
|
||||
},
|
||||
"contextName": "SAS Job Execution compute context"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -237,6 +237,30 @@ run;
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='01'x then do; /* Unprintable */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='07'x then do; /* Bell Char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'7');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='1B'x then do; /* escape char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'B');rc =fwrite(fileid);
|
||||
end;
|
||||
else do;
|
||||
rc =fput(fileid,rec);
|
||||
rc =fwrite(fileid);
|
||||
|
||||
@@ -675,6 +675,22 @@ run;
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='07'x then do; /* Bell Char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'7');rc =fwrite(fileid);
|
||||
end;
|
||||
else if rec='1B'x then do; /* escape char */
|
||||
rc =fput(fileid,'\');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'u');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'0');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'1');rc =fwrite(fileid);
|
||||
rc =fput(fileid,'B');rc =fwrite(fileid);
|
||||
end;
|
||||
else do;
|
||||
rc =fput(fileid,rec);
|
||||
rc =fwrite(fileid);
|
||||
|
||||
Reference in New Issue
Block a user