The script does not read tabular data. It manipulates SAS Viya metadata objects. The data necessary for role creation (name, attributes, capabilities, target group) are defined directly in the SAS code, without depending on external data sources or SASHELP.
1 Code Block
DATA STEP
Explanation : This DATA step block uses a series of SAS Metadata functions to perform administrative operations. It starts by initializing variables. Then, it creates a new metadata object of type 'IdentityGroup' (representing a role) with a specific name ('New Role Name'). Mandatory and optional attributes are defined for this role. The script then retrieves the URI of a capability ('Server Manager') from the metadata and associates it with the role. Finally, it adds the newly created role to an existing identity group named 'group1'. All these operations are persistent in the SAS Viya metadata repository.
Copied!
data _null_;
/**** Initialize Variables ****/
length uri $ 38 cap_uri $ 43;
call missing (of _character_);
/**** Create the object. ****/
rc=metadata_newobj("IdentityGroup",uri,"New Role Name");
/* Add some required attributes. */
rc=metadata_setattr(uri,"PublicType","Role");
rc=metadata_setattr(uri,"GroupType","ROLE");
rc=metadata_setattr(uri,"UsageVersion","1000000.0");
rc=metadata_setattr(uri,"IsHidden","0");
/* Add some optional attributes. */
rc=metadata_setattr(uri,"Desc","This is the description of the new role");
rc=metadata_setattr(uri,"DisplayName","This is the display name of the role");
/**** Add a capability. ****/
/* Define the search for the access control entry for the cability */
cap_obj="omsobj:AccessControlEntry?AccessControlEntry[Objects/ApplicationAction[ @Name='Server Manager']]";
/* Pull it's URI into the variable cap_uri */
rc=metadata_getnobj(cap_obj,1,cap_uri);
/* Add the capability association to the role. */
rc=metadata_setassn(uri,"AccessControlEntries","APPEND",cap_uri);
/**** Add the Role to a Group ****/
rc=metadata_setassn(uri,"MemberIdentities","APPEND","omsobj:IdentityGroup? @Name='group1'");
run;
1
DATA _null_;
2
/**** Initialize Variables ****/
3
LENGTH uri $ 38 cap_uri $ 43;
4
call missing (of _character_);
5
6
/**** Create the object. ****/
7
rc=metadata_newobj("IdentityGroup",uri,"New Role Name");
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Author: Greg Wootton Date: 09OCT2020
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.