<?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 Re: Extract Visual Analytics Shared Users and Groups in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/780220#M23403</link>
    <description>&lt;P&gt;Thanks for the response, using the authorization microservice and your approached worked perfectly! There also looks to be a specific endpoint that just returns a list of shared items too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/authorization/shares&lt;/P&gt;</description>
    <pubDate>Mon, 15 Nov 2021 11:01:43 GMT</pubDate>
    <dc:creator>DLangley</dc:creator>
    <dc:date>2021-11-15T11:01:43Z</dc:date>
    <item>
      <title>Extract Visual Analytics Shared Users and Groups</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/779991#M23399</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi All&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm trying to write something to extract which SAS VIYA users have access to which SAS VIYA VISUAL ANALYTICS dashboards. Is this possible?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've looked into the identities REST API which can list all users and their membership groups, and the reports REST API which lists some simple summary stats for each dashboard and any tables they may use, but i've had no luck determining which reports are shared with an individual user or membership group.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://developer.sas.com/apis/rest/Visualization/" target="_blank" rel="noopener"&gt;https://developer.sas.com/apis/rest/Visualization/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help is appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let BASE_URI = %sysfunc(getoption(servicesbaseurl));
%let BASE_DIR = /SAS Content;


%macro report_get_all();
	filename rrep temp;
	
	proc http 
		oauth_bearer=sas_services 
		method="GET" 
		url="&amp;amp;BASE_URI./reports/reports?%nrstr(start=0&amp;amp;limit=200)"
		out=rrep;
		headers "Accept"="application/json";
	run;
	
	libname rrep json;
	
	proc sql;
		insert into work.report(id, name)
			select id, name 
			from rrep.items
		;
	run;

	libname rrep clear;
	filename rrep clear;
%mend;

%macro report_get_tables(REPORT_ID);
	filename rcontent temp;
	
	proc http 
		oauth_bearer=sas_services 
		method="GET" 
		url="&amp;amp;BASE_URI./reports/reports/&amp;amp;REPORT_ID./content"
		out=rcontent;
		headers "Accept"="application/vnd.sas.report.content+json";
	run;
	
	libname rcontent json;

	%if %sysfunc(exist(rcontent.datasources_casresource)) %then %do;
		proc sql;
			insert into work.report_table(id, server, library, table, locale)
				select 	"&amp;amp;REPORT_ID."
					,	server
					,	library
					,	table
					,	locale
				from rcontent.datasources_casresource
			;
		quit;
	%end;

	libname rcontent clear;
	filename rcontent clear;
%mend;

%macro report_get_path(REPORT_ID);
	filename rpath temp;
	
	proc http 
		oauth_bearer=sas_services 
		method='GET' 
		url="&amp;amp;BASE_URI./folders/ancestors?childUri=/reports/reports/&amp;amp;REPORT_ID."
		out=rpath;
		headers 'Accept'='application/vnd.sas.content.folder.ancestor+json';
	run;
	
	libname rpath json;
	
	proc sql noprint;
		select name into :file_path separated by '/'
		from rpath.ancestors 
		order by ordinal_ancestors desc
		;

		insert into work.report_path(id, directory)
			values("&amp;amp;REPORT_ID.", "&amp;amp;file_path.")
		;
	quit;
	
	libname rpath clear;
	filename rpath clear;
%mend;

%macro report();
	proc sql;
		create table work.report(
				id char(64),
				name char(64),
	
				constraint primary_key primary key(id)
		);

		create table work.report_path(
				id char(64),
				directory char(256),
	
				constraint primary_key primary key(id)
		);
	
		create table work.report_table(
				id char(64),
				server char(32),
				library char(32),
				table char(64),
				locale char(8),
	
				constraint primary_key primary key(id, server, library, table)
		);
	quit;
	
	%report_get_all();
	
	data _null_;
		set work.report;
		
		call execute('%nrstr(%report_get_path(' || trim(id) || '))');
		call execute('%nrstr(%report_get_tables(' || trim(id) || '))');
	run;
%mend;


%report();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Nov 2021 15:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/779991#M23399</guid>
      <dc:creator>DLangley</dc:creator>
      <dc:date>2021-11-12T15:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Visual Analytics Shared Users and Groups</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/780001#M23400</link>
      <description>&lt;P&gt;I would probably start with a call to the authorization microservice to see what rules exist against report object URIs, then call that object uri to get the name of the report, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This filter says to only return rules against Object URIs that start with "/report/reports" and a description containing "shared", as sharing adds a description to saying who shared it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/authorization/rules?filter=and(startsWith(objectUri,"/reports/reports/"),contains(description,"shared"))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/780001#M23400</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2021-11-12T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Visual Analytics Shared Users and Groups</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/780220#M23403</link>
      <description>&lt;P&gt;Thanks for the response, using the authorization microservice and your approached worked perfectly! There also looks to be a specific endpoint that just returns a list of shared items too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/authorization/shares&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 11:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Extract-Visual-Analytics-Shared-Users-and-Groups/m-p/780220#M23403</guid>
      <dc:creator>DLangley</dc:creator>
      <dc:date>2021-11-15T11:01:43Z</dc:date>
    </item>
  </channel>
</rss>

