<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Extracting User, Group and Roles in SAS SMC in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407547#M3810</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to ask on how can I extract all the User, Groups and Roles that are registered in SMC? I have this code below but when I trybto use it, it doesn't get me an output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Connect to the metadata server*/&lt;BR /&gt;options metaserver="localhost"&lt;BR /&gt;metaport=8561&lt;BR /&gt;metauser="myuser"&lt;BR /&gt;metapass="mypassword"&lt;BR /&gt;metarepository="Foundation"&lt;BR /&gt;metaprotocol=BRIDGE;&lt;/P&gt;&lt;P&gt;data users_grps_roles;&lt;BR /&gt;length uri name DisplayName grp groupuri $256 grptype $5 id MDUpdate $20;&lt;/P&gt;&lt;P&gt;/*Initialize variables to missing*/&lt;BR /&gt;n=1;&lt;BR /&gt;uri='';&lt;BR /&gt;name='';&lt;BR /&gt;Displayname='';&lt;BR /&gt;grp='';&lt;BR /&gt;groupuri='';&lt;BR /&gt;grptype='';&lt;BR /&gt;id='';&lt;BR /&gt;MDUpdate='';&lt;/P&gt;&lt;P&gt;/*Determine how many person objects are defined*/&lt;BR /&gt;nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);&lt;/P&gt;&lt;P&gt;if nobj=0 then&lt;BR /&gt;put 'No Persons available.';&lt;BR /&gt;else&lt;BR /&gt;do while (nobj &amp;gt; 0);&lt;BR /&gt;/*Retrieve the current person's name*/&lt;BR /&gt;rc=metadata_getattr(uri, "Name", Name);&lt;/P&gt;&lt;P&gt;/*Retrieve the current person's displayname*/&lt;BR /&gt;rc=metadata_getattr(uri, "DisplayName", DisplayName);&lt;BR /&gt;rc=metadata_getattr(uri, "MetadataUpdated", MDUpdate);&lt;/P&gt;&lt;P&gt;/*Get the group association information for the current person*/&lt;BR /&gt;a=1;&lt;BR /&gt;grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);&lt;/P&gt;&lt;P&gt;/*If this person does not belong to any groups, set their group&lt;BR /&gt;variable to 'NONE'*/&lt;BR /&gt;if grpassn in (-3,-4) then&lt;BR /&gt;do;&lt;BR /&gt;grp="NONE";&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/*If the person belongs to any groups, loop through the list&lt;BR /&gt;and retrieve the name of each group, outputting each on a&lt;BR /&gt;separate record. If the GroupType is a &amp;lt;blank&amp;gt;, then set the&lt;BR /&gt;grptype to GROUP. If the GroupType is a ROLE, then the&lt;BR /&gt;grptype is already set to ROLE. This will be used in the&lt;BR /&gt;PROC REPORT step.*/&lt;BR /&gt;else&lt;BR /&gt;do while (grpassn &amp;gt; 0);&lt;BR /&gt;rc2=metadata_getattr(groupuri, "Name", grp);&lt;BR /&gt;rc3=metadata_getattr(groupuri, "GroupType", grptype);&lt;/P&gt;&lt;P&gt;if grptype = '' then&lt;BR /&gt;do;&lt;BR /&gt;grptype="GROUP";&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;output;&lt;BR /&gt;a+1;&lt;BR /&gt;grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/*Retrieve the next person's information*/&lt;BR /&gt;n+1;&lt;BR /&gt;nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;keep name DisplayName MDUpdate grp grptype;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;options ls=200 ps=200;&lt;/P&gt;&lt;P&gt;/*Display the list of users and their groups*/&lt;BR /&gt;proc report data=users_grps_roles nowd headline headskip spanrows;&lt;BR /&gt;columns grptype grp name DisplayName groups roles MDUpdate;&lt;BR /&gt;define name / order 'User Name' format=$30.;&lt;BR /&gt;define DisplayName / order 'User DisplayName' format=$40.;&lt;BR /&gt;define grp / noprint;&lt;BR /&gt;define grptype / noprint;&lt;BR /&gt;define groups / computed 'Groups' format=$40.;&lt;BR /&gt;define roles / computed 'Roles' format=$40.;&lt;/P&gt;&lt;P&gt;compute groups / char length = 40;&lt;/P&gt;&lt;P&gt;if grptype = 'GROUP' then&lt;BR /&gt;groups = grp;&lt;BR /&gt;else if grp = 'NONE' then&lt;BR /&gt;groups = 'NONE';&lt;BR /&gt;else groups = ' ';&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;compute roles / char length = 40;&lt;/P&gt;&lt;P&gt;if grptype = 'ROLE' then&lt;BR /&gt;roles = grp;&lt;BR /&gt;else if grp = 'NONE' then&lt;BR /&gt;roles = 'NONE';&lt;BR /&gt;else roles = ' ';&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;define MDUpdate / display 'Last Updated' format=$20.;&lt;BR /&gt;break after name / skip;&lt;BR /&gt;title 'Listing of Users and associated Groups and Roles';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Albert&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2017 06:39:04 GMT</pubDate>
    <dc:creator>Albert0</dc:creator>
    <dc:date>2017-10-26T06:39:04Z</dc:date>
    <item>
      <title>Extracting User, Group and Roles in SAS SMC</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407547#M3810</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to ask on how can I extract all the User, Groups and Roles that are registered in SMC? I have this code below but when I trybto use it, it doesn't get me an output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Connect to the metadata server*/&lt;BR /&gt;options metaserver="localhost"&lt;BR /&gt;metaport=8561&lt;BR /&gt;metauser="myuser"&lt;BR /&gt;metapass="mypassword"&lt;BR /&gt;metarepository="Foundation"&lt;BR /&gt;metaprotocol=BRIDGE;&lt;/P&gt;&lt;P&gt;data users_grps_roles;&lt;BR /&gt;length uri name DisplayName grp groupuri $256 grptype $5 id MDUpdate $20;&lt;/P&gt;&lt;P&gt;/*Initialize variables to missing*/&lt;BR /&gt;n=1;&lt;BR /&gt;uri='';&lt;BR /&gt;name='';&lt;BR /&gt;Displayname='';&lt;BR /&gt;grp='';&lt;BR /&gt;groupuri='';&lt;BR /&gt;grptype='';&lt;BR /&gt;id='';&lt;BR /&gt;MDUpdate='';&lt;/P&gt;&lt;P&gt;/*Determine how many person objects are defined*/&lt;BR /&gt;nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);&lt;/P&gt;&lt;P&gt;if nobj=0 then&lt;BR /&gt;put 'No Persons available.';&lt;BR /&gt;else&lt;BR /&gt;do while (nobj &amp;gt; 0);&lt;BR /&gt;/*Retrieve the current person's name*/&lt;BR /&gt;rc=metadata_getattr(uri, "Name", Name);&lt;/P&gt;&lt;P&gt;/*Retrieve the current person's displayname*/&lt;BR /&gt;rc=metadata_getattr(uri, "DisplayName", DisplayName);&lt;BR /&gt;rc=metadata_getattr(uri, "MetadataUpdated", MDUpdate);&lt;/P&gt;&lt;P&gt;/*Get the group association information for the current person*/&lt;BR /&gt;a=1;&lt;BR /&gt;grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);&lt;/P&gt;&lt;P&gt;/*If this person does not belong to any groups, set their group&lt;BR /&gt;variable to 'NONE'*/&lt;BR /&gt;if grpassn in (-3,-4) then&lt;BR /&gt;do;&lt;BR /&gt;grp="NONE";&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/*If the person belongs to any groups, loop through the list&lt;BR /&gt;and retrieve the name of each group, outputting each on a&lt;BR /&gt;separate record. If the GroupType is a &amp;lt;blank&amp;gt;, then set the&lt;BR /&gt;grptype to GROUP. If the GroupType is a ROLE, then the&lt;BR /&gt;grptype is already set to ROLE. This will be used in the&lt;BR /&gt;PROC REPORT step.*/&lt;BR /&gt;else&lt;BR /&gt;do while (grpassn &amp;gt; 0);&lt;BR /&gt;rc2=metadata_getattr(groupuri, "Name", grp);&lt;BR /&gt;rc3=metadata_getattr(groupuri, "GroupType", grptype);&lt;/P&gt;&lt;P&gt;if grptype = '' then&lt;BR /&gt;do;&lt;BR /&gt;grptype="GROUP";&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;output;&lt;BR /&gt;a+1;&lt;BR /&gt;grpassn=metadata_getnasn(uri,"IdentityGroups",a,groupuri);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/*Retrieve the next person's information*/&lt;BR /&gt;n+1;&lt;BR /&gt;nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;keep name DisplayName MDUpdate grp grptype;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;options ls=200 ps=200;&lt;/P&gt;&lt;P&gt;/*Display the list of users and their groups*/&lt;BR /&gt;proc report data=users_grps_roles nowd headline headskip spanrows;&lt;BR /&gt;columns grptype grp name DisplayName groups roles MDUpdate;&lt;BR /&gt;define name / order 'User Name' format=$30.;&lt;BR /&gt;define DisplayName / order 'User DisplayName' format=$40.;&lt;BR /&gt;define grp / noprint;&lt;BR /&gt;define grptype / noprint;&lt;BR /&gt;define groups / computed 'Groups' format=$40.;&lt;BR /&gt;define roles / computed 'Roles' format=$40.;&lt;/P&gt;&lt;P&gt;compute groups / char length = 40;&lt;/P&gt;&lt;P&gt;if grptype = 'GROUP' then&lt;BR /&gt;groups = grp;&lt;BR /&gt;else if grp = 'NONE' then&lt;BR /&gt;groups = 'NONE';&lt;BR /&gt;else groups = ' ';&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;compute roles / char length = 40;&lt;/P&gt;&lt;P&gt;if grptype = 'ROLE' then&lt;BR /&gt;roles = grp;&lt;BR /&gt;else if grp = 'NONE' then&lt;BR /&gt;roles = 'NONE';&lt;BR /&gt;else roles = ' ';&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;define MDUpdate / display 'Last Updated' format=$20.;&lt;BR /&gt;break after name / skip;&lt;BR /&gt;title 'Listing of Users and associated Groups and Roles';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Albert&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 06:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407547#M3810</guid>
      <dc:creator>Albert0</dc:creator>
      <dc:date>2017-10-26T06:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting User, Group and Roles in SAS SMC</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407582#M3811</link>
      <description>&lt;P&gt;&lt;A href=" http://support.sas.com/documentation/cdl/en/bisecag/69827/PDF/default/bisecag.pdf" target="_self"&gt;http://support.sas.com/documentation/cdl/en/bisecag/69827/PDF/default/bisecag.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search for %mduextr.&amp;nbsp; Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 09:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407582#M3811</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-10-26T09:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting User, Group and Roles in SAS SMC</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407583#M3812</link>
      <description>Hi guys...I've managed to make the program worked</description>
      <pubDate>Thu, 26 Oct 2017 09:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Extracting-User-Group-and-Roles-in-SAS-SMC/m-p/407583#M3812</guid>
      <dc:creator>Albert0</dc:creator>
      <dc:date>2017-10-26T09:23:29Z</dc:date>
    </item>
  </channel>
</rss>

