Sample 30682: List users and groups that are defined in a metadata repository
This sample program illustrates one way in which the SAS® Open Metadata Interface can be used to generate a listing of users and their group memberships as they are defined in a SAS metadata repository.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Before submitting this code, you must provide site-specific values for the META* options at the beginning of the program.
/* Use the META* options to specify the options for connecting to the */
/* metadata server that contains the user information. */
options metaserver=metadata_server_name.IP_address /* network name/address of the metadata server, */
/* for example, metaserver=d441.na.sas.com) */
metaport=8561 /* The port on which the metadata server is listening. */
metauser="metadata\userid" /* The domain-qualified user ID for the connection to */
/* the metadata server. */
metapass="password" /* Password for the METAUSER= user ID. */
metaprotocol=bridge /* Protocol for the metadata server. */
metarepository=Foundation; /* The default location of the user information that */
/* is in the foundation repository. */
data users_grps;
length uri name group groupuri $256 id $20;
/* Initialize variables to missing. */
n=1;
uri='';
name='';
group='';
groupuri='';
id='';
/* Determine how many person objects are defined. */
nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
if nobj=0 then put 'No Persons available.';
else do while (nobj > 0);
/* Retrieve the current person's name. */
rc=metadata_getattr(uri, "Name", Name);
/* Get the group association information for the current person. */
a=1;
grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);
/* If this person does not belong to any groups, set their group */
/* variable to 'No groups' and output the name. */
if grpassn in (-3,-4) then do;
group="No groups";
output;
end;
/* If the person belongs to any groups, loop through the list */
/* and retrieve the name of each group, outputting each on a */
/* separate record. */
else do while (grpassn > 0);
rc2=metadata_getattr(groupuri, "Name", group);
a+1;
output;
grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);
end;
/* Retrieve the next person's information. */
n+1;
nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);
end;
keep name group;
run;
/* Display the list of users and their groups. */
proc report data=users_grps nowd headline headskip;
columns name group;
define name / order 'User Name' format=$30.;
define group / order 'Group' format=$30.;
break after name / skip;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
User Name Group
SAS Administrator No groups
SAS Demo User Oracle Group
Portal Demos
User Group 1
SAS Guest No groups
SAS Trusted User SAS General Servers
SAS System Services
SAS Web Administrator Portal Admins
SAS System Services
Create a report that shows each user defined in metadata, along with any groups to which he or she belongs.
Date Modified: | 2008-09-10 15:38:16 |
Date Created: | 2007-12-04 10:10:37 |
Operating System and Release Information
SAS System | SAS Metadata Server | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for x64 | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |