BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I was wondering if there was method to query the metadata to give me all users and their rights. From the metadata referenceguide and libname statement i can only extract my connections/rights. If someone can tell me how or point me to where i can read more on this I would appreciate it.
2 REPLIES 2
FredrikE
Rhodochrosite | Level 12
Just some code to help you get in the right direction....
The following program makes a list of all libnames and which ACT that are connected to them:

options metaprotocol=bridge
metauser="USER"
metapass="PASSWORD"
metarepository="Foundation";

data library_act(keep=library_name ACT_name hasIdentity);
length lib_uri ACT_uri library_name ACT_name PT_uri $256;
nobj=0;
n = 1;
ACT_uri=''; lib_uri=''; PT_uri=''; library_name = '';
/* Determine how many SASLibrary objects are in this repository. */
nobj=metadata_getnobj("omsobj:SASLibrary?@id contains '.'",n,lib_uri);
do until(nobj < 0);
/* Get libref attributes */
rc = metadata_getattr(lib_uri,"Name",library_name);
rc = metadata_getnasn(lib_uri,"AccessControls",1,ACT_uri);
ACT_name ='';
hasIdentity = 0;

if rc > 0 then do;
rc = metadata_getattr(ACT_uri,"Name",ACT_name);
rc1 = metadata_getnasn(ACT_uri,"Identities",1,PT_uri);
if rc1 > 0 then hasIdentity = 1;
rc1 = metadata_getnasn(ACT_uri,"AccessControlItems",1,PT_uri);
if rc1 > 0 then hasIdentity = 1;
end;

if ACT_name = '' then ACT_name = 'missing';
n=n+1;
output;
nobj=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",n,lib_uri);
end; /* do until */
run; Metabrowse is very useful and you will find more datastep functions for reading metadata in SAS-documentation. You can also use xml to get the same result, i have not done that thou'


Message was edited by: FredrikE
deleted_user
Not applicable
Thank you FrederikE, i will try working with this tomorrow

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 689 views
  • 0 likes
  • 2 in conversation