1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-15 12:30:06 +00:00

Merge pull request #257 from sasjs/userfeat

feat: filter mm_getusers on a particular user
This commit is contained in:
2022-06-17 19:59:38 +02:00
committed by GitHub
2 changed files with 92 additions and 38 deletions

65
all.sas
View File

@@ -17783,17 +17783,18 @@ libname _XML_ clear;
%mm_getusers() %mm_getusers()
Optionally, filter for a user (useful to get the uri):
%mm_getusers(user=&_metaperson)
@param outds the dataset to create that contains the list of libraries @param outds the dataset to create that contains the list of libraries
@returns outds dataset containing all users, with the following columns: @returns outds dataset containing all users, with the following columns:
- uri - uri
- name - name
@warning The following filenames are created and then de-assigned: @param user= (0) Set to a metadata user to filter on that user
@param outds= (work.mm_getusers) The output table to create
filename sxlemap clear;
filename response clear;
libname _XML_ clear;
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@@ -17801,23 +17802,49 @@ libname _XML_ clear;
**/ **/
%macro mm_getusers( %macro mm_getusers(
outds=work.mm_getusers outds=work.mm_getusers,
user=0
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
filename response temp; filename response temp;
proc metadata in= '<GetMetadataObjects> %if %superq(user)=0 %then %do;
<Reposid>$METAREPOSITORY</Reposid> proc metadata in= '<GetMetadataObjects>
<Type>Person</Type> <Reposid>$METAREPOSITORY</Reposid>
<NS>SAS</NS> <Type>Person</Type>
<Flags>0</Flags> <NS>SAS</NS>
<Options> <Flags>0</Flags>
<Templates> <Options>
<Person Name=""/> <Templates>
</Templates> <Person Name=""/>
</Options> </Templates>
</GetMetadataObjects>' </Options>
out=response; </GetMetadataObjects>'
run; out=response;
run;
%end;
%else %do;
filename inref temp;
data _null_;
file inref;
put "<GetMetadataObjects>";
put "<Reposid>$METAREPOSITORY</Reposid>";
put "<Type>Person</Type>";
put "<NS>SAS</NS>";
put "<!-- Specify the OMI_XMLSELECT (128) flag -->";
put "<Flags>128</Flags>";
put "<Options>";
put "<Templates>";
put '<Person Name=""/>';
put "</Templates>";
length string $10000;
string=cats('<XMLSELECT search="Person[@Name=',"'&user'",']"/>');
put string;
put "</Options>";
put "</GetMetadataObjects>";
run;
proc metadata in=inref out=response;
run;
%end;
filename sxlemap temp; filename sxlemap temp;
data _null_; data _null_;

View File

@@ -8,17 +8,18 @@
%mm_getusers() %mm_getusers()
Optionally, filter for a user (useful to get the uri):
%mm_getusers(user=&_metaperson)
@param outds the dataset to create that contains the list of libraries @param outds the dataset to create that contains the list of libraries
@returns outds dataset containing all users, with the following columns: @returns outds dataset containing all users, with the following columns:
- uri - uri
- name - name
@warning The following filenames are created and then de-assigned: @param user= (0) Set to a metadata user to filter on that user
@param outds= (work.mm_getusers) The output table to create
filename sxlemap clear;
filename response clear;
libname _XML_ clear;
@version 9.3 @version 9.3
@author Allan Bowe @author Allan Bowe
@@ -26,23 +27,49 @@
**/ **/
%macro mm_getusers( %macro mm_getusers(
outds=work.mm_getusers outds=work.mm_getusers,
user=0
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
filename response temp; filename response temp;
proc metadata in= '<GetMetadataObjects> %if %superq(user)=0 %then %do;
<Reposid>$METAREPOSITORY</Reposid> proc metadata in= '<GetMetadataObjects>
<Type>Person</Type> <Reposid>$METAREPOSITORY</Reposid>
<NS>SAS</NS> <Type>Person</Type>
<Flags>0</Flags> <NS>SAS</NS>
<Options> <Flags>0</Flags>
<Templates> <Options>
<Person Name=""/> <Templates>
</Templates> <Person Name=""/>
</Options> </Templates>
</GetMetadataObjects>' </Options>
out=response; </GetMetadataObjects>'
run; out=response;
run;
%end;
%else %do;
filename inref temp;
data _null_;
file inref;
put "<GetMetadataObjects>";
put "<Reposid>$METAREPOSITORY</Reposid>";
put "<Type>Person</Type>";
put "<NS>SAS</NS>";
put "<!-- Specify the OMI_XMLSELECT (128) flag -->";
put "<Flags>128</Flags>";
put "<Options>";
put "<Templates>";
put '<Person Name=""/>';
put "</Templates>";
length string $10000;
string=cats('<XMLSELECT search="Person[@Name=',"'&user'",']"/>');
put string;
put "</Options>";
put "</GetMetadataObjects>";
run;
proc metadata in=inref out=response;
run;
%end;
filename sxlemap temp; filename sxlemap temp;
data _null_; data _null_;