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

feat: filter mm_getusers on a particular user

This can be useful for extracting the uri of a metadata user
This commit is contained in:
Allan Bowe
2022-06-17 17:03:25 +00:00
parent 54a24ced83
commit 767ddd7add
2 changed files with 82 additions and 38 deletions

60
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,44 @@ 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>
<Reposid>$METAREPOSITORY</Reposid> %if %superq(&user)=0 %then %do;
<Type>Person</Type> proc metadata in= '<GetMetadataObjects>
<NS>SAS</NS> <Reposid>$METAREPOSITORY</Reposid>
<Flags>0</Flags> <Type>Person</Type>
<Options> <NS>SAS</NS>
<Templates> <Flags>0</Flags>
<Person Name=""/> <Options>
</Templates> <Templates>
</Options> <Person Name=""/>
</GetMetadataObjects>' </Templates>
out=response; </Options>
run; </GetMetadataObjects>'
out=response;
run;
%end;
%else %do;
proc metadata in= "<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<NS>SAS</NS>
<!-- Specify the OMI_XMLSELECT (128) flag -->
<Flags>128</Flags>
<Options>
<Templates>
<Person Name=""/>
</Templates>
<XMLSELECT search=""Person[@Name='&user']""/>
</Options>
</GetMetadataObjects>"
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,44 @@
**/ **/
%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>
<Reposid>$METAREPOSITORY</Reposid> %if %superq(&user)=0 %then %do;
<Type>Person</Type> proc metadata in= '<GetMetadataObjects>
<NS>SAS</NS> <Reposid>$METAREPOSITORY</Reposid>
<Flags>0</Flags> <Type>Person</Type>
<Options> <NS>SAS</NS>
<Templates> <Flags>0</Flags>
<Person Name=""/> <Options>
</Templates> <Templates>
</Options> <Person Name=""/>
</GetMetadataObjects>' </Templates>
out=response; </Options>
run; </GetMetadataObjects>'
out=response;
run;
%end;
%else %do;
proc metadata in= "<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<NS>SAS</NS>
<!-- Specify the OMI_XMLSELECT (128) flag -->
<Flags>128</Flags>
<Options>
<Templates>
<Person Name=""/>
</Templates>
<XMLSELECT search=""Person[@Name='&user']""/>
</Options>
</GetMetadataObjects>"
out=response;
run;
%end;
filename sxlemap temp; filename sxlemap temp;
data _null_; data _null_;