Posted By

ccw on 03/26/12


Tagged

control access sas


Versions (?)

[SAS] Applying ACT


 / Published in: SAS
 

Applying Access Control Template to specific objects

  1. %macro applyACT(objName, objType, actName, metaUser, metaPass, metaServer=localhost, metaPort=8561);
  2.  
  3. options metauser="&metaUser"
  4. metapass="&metaPass"
  5. metaserver="&metaServer"
  6. metaport=&metaPort
  7. metarepository=Foundation;
  8.  
  9. filename request temp ;
  10. filename response temp ;
  11.  
  12. data _null_ ;
  13. length type $32 t_uri act_uri ace_uri $ 17 line $ 100 ;
  14. file request ;
  15.  
  16. line="omsobj:&objType?@Name='&objName'";
  17. rc=metadata_resolve(line,type,t_uri) ;
  18.  
  19. line="omsobj:AccessControlTemplate?@Name='&actName'";
  20. rc=metadata_resolve(line,type,act_uri) ;
  21.  
  22. line="omsobj:AccessControlEntry?AccessControlEntry[/Objects/&objType[@Name='&objName']]";
  23. rc=metadata_resolve(line,type,ace_uri) ;
  24.  
  25. put "" ;
  26. put "" ;
  27.  
  28. line="<&objType Id='"|| strip(t_uri)|| "' >";
  29. put line ;
  30. put "" ;
  31. line=cats("") ;
  32. put line ;
  33. if strip(ace_uri) <> '' then
  34. do;
  35. line=cats("") ;
  36. put line ;
  37. end;
  38. put "";
  39. put "" ;
  40.  
  41. if strip(ace_uri) <> '' then
  42. do;
  43. line=cats("") ;
  44. put line ;
  45. line=cats("") ;
  46. put line ;
  47. line=cats("") ;
  48. put line ;
  49. line=cats("") ;
  50. put line ;
  51. end;
  52.  
  53. /* uncomment below for SAS 9.1.3 */
  54. * put "" ;
  55. put "" ;
  56.  
  57. /* uncomment below for SAS 9.1.3 */
  58. * put "$METAREPOSITORY" ;
  59. put "SAS" ;
  60. put "402654208" ;
  61. put "" ;
  62. put "" ;
  63. run ;
  64.  
  65. proc metadata verbose header=full
  66. in=request
  67. out=response ;
  68. run ;
  69.  
  70. %mend;
  71.  
  72. /* to apply ACT [TestACT] to Lib [TestLib] */
  73. %applyACT(TestLib, SASLibrary, Test_ACT, sasadm, sasadm);
  74.  
  75. /* to apply ACT [TestACT] to Dataset [TestTable] */
  76. %applyACT(TestTable, PhysicalTable, Test_ACT, sasadm, sasadm);

Report this snippet  

You need to login to post a comment.