This is a test job I wrote a few weeks ago to list out my custom security policies, roles and queries associated with it into a table. Hope someone finds it useful.
| static void DN_LoadSecPolMeta(Args _args) | |
| { | |
| #AOT | |
| Treenode secPolicyNode; | |
| Treenode secPolicy; | |
| NoYesId noyesid; | |
| str secPolicyName, secRole, secQuery, strPrimaryTable; | |
| int i; | |
| int nodeCount; | |
| DN_SecPol secpoltst; | |
| secPolicyNode = treenode::findNode(#SecPoliciesPath); | |
| // Count of all the secPolicys. | |
| nodeCount = secPolicyNode.AOTchildNodeCount(); | |
| secPolicy = secPolicyNode.AOTfirstChild(); | |
| for (i=1; i<=nodeCount; ++i) | |
| { | |
| secPolicyName = secPolicy.AOTgetProperty("Name"); | |
| secRole = secPolicy.AOTgetProperty("RoleName"); | |
| secQuery = secPolicy.AOTgetProperty("Query"); | |
| if(secPolicyName like 'DN*' && secPolicy.AOTgetProperty("PolicyGroup") == 'Record Security') //Spit out only custom security policies having RLS Security | |
| { | |
| secpoltst.RoleName = secRole; | |
| secpoltst.PolicyName = secPolicyName; | |
| secpoltst.QueryName = secQuery; | |
| secpoltst.PrimaryTable = secPolicy.AOTgetProperty("PrimaryTable"); | |
| secpoltst.Enabled = NoYes::Yes; | |
| secpoltst.doInsert(); | |
| } | |
| secPolicy = secPolicy.AOTnextSibling(); | |
| } | |
| } |
ocisbrahraMurfreesboro Adam Smallwood https://wakelet.com/wake/ho6VGmPmW--0yb5C_Uc-5
ReplyDeletesilourrasi