/ Published in: SAS
Applying Access Control Template to specific objects
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
%macro applyACT(objName, objType, actName, metaUser, metaPass, metaServer=localhost, metaPort=8561); options metauser="&metaUser" metapass="&metaPass" metaserver="&metaServer" metaport=&metaPort metarepository=Foundation; filename request temp ; filename response temp ; data _null_ ; length type $32 t_uri act_uri ace_uri $ 17 line $ 100 ; file request ; line="omsobj:&objType?@Name='&objName'"; rc=metadata_resolve(line,type,t_uri) ; line="omsobj:AccessControlTemplate?@Name='&actName'"; rc=metadata_resolve(line,type,act_uri) ; line="omsobj:AccessControlEntry?AccessControlEntry[/Objects/&objType[@Name='&objName']]"; rc=metadata_resolve(line,type,ace_uri) ; put "" ; put "" ; line="<&objType Id='"|| strip(t_uri)|| "' >"; put line ; put "" ; line=cats("") ; put line ; if strip(ace_uri) <> '' then do; line=cats("") ; put line ; end; put ""; put "" ; if strip(ace_uri) <> '' then do; line=cats("") ; put line ; line=cats("") ; put line ; line=cats("") ; put line ; line=cats("") ; put line ; end; /* uncomment below for SAS 9.1.3 */ * put "" ; put "" ; /* uncomment below for SAS 9.1.3 */ * put "$METAREPOSITORY" ; put "SAS" ; put "402654208" ; put "" ; put "" ; run ; proc metadata verbose header=full in=request out=response ; run ; %mend; /* to apply ACT [TestACT] to Lib [TestLib] */ %applyACT(TestLib, SASLibrary, Test_ACT, sasadm, sasadm); /* to apply ACT [TestACT] to Dataset [TestTable] */ %applyACT(TestTable, PhysicalTable, Test_ACT, sasadm, sasadm);