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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
2 comments:
Why do look for your prefix and not for for the Layer you used for custimazation? Like this: if(UtilEntryLevel::cus == node.applObjectLayer())
That way you would also get the objects which online were modified.
Hi I have a blog with tips and trick about Dynamics AX, check this out in http://www.dynamicsaxlatino.com
Post a Comment