x++
Where are Duties (table name) stored in AX?
I want to access Security duties (in code), but I don't know where they are stored (in which table)? Privileges are stored in SecurityTask, now I need to know where duties are stored in AX 2012. Thank you.
Security duties are in table SecurityTask with Type equal to 1 (SecurityTaskType::Duty). Security privileges are in table SecurityTask with Type equal to 0 (SecurityTaskType::Privilege) Security process cycles are in table SecurityTask with Type equal to 2 (SecurityTaskType::ProcessCycle). All these objects are also in table (or rather view) SysModelElement (Duties with ElementType == 135).
I found it here: http://arsalanax.blogspot.be/2012/02/role-based-security-in-ax.html Roles are stored in SecurityRole User to role mappings in SecurityUserRole Duties & privileges stored in SecurityTask Duty to privileges mappings are stored in SecuritySubTask Role to duty mappings are stored in SecurityRoleTaskGrant UPDATE (query added) SecurityTaskEntryPoint taskEntryPoint; SecurityRole role; SecurityRoleTaskGrant taskGrant; SecuritySubTask subTask; SecurityTask privilege; str privName; str dutyName; str entrName; str accessLevel; ; while select taskEntryPoint join subTask where subTask.SecuritySubTask == taskEntryPoint.SecurityTask join taskGrant where taskGrant.SecurityTask == subTask.SecurityTask join role where role.RecId == taskGrant.SecurityRole && role.AotName like 'Sales*' //|| role.AotName like 'System*' { if (subTask.RecId) { switch (taskEntryPoint.PermissionGroup) { case AccessRight::View: accessLevel = "R"; break; case AccessRight::Edit: accessLevel = "U"; break; case AccessRight::Add: accessLevel = "C"; break; case AccessRight::Delete: accessLevel = "D"; break; default: accessLevel = ""; break; } } select privilege where privilege.RecId == taskGrant.SecurityTask && SecurityTaskType::Duty == privilege.Type; dutyName = privilege.AotName; select privilege where privilege.RecId == subTask.SecuritySubTask && SecurityTaskType::Privilege == privilege.Type; privName = privilege.AotName; info(strFmt("EP: %1, Pr: '%2', Du: %3, Ro: %4, Ac: %5", taskEntryPoint.EntryPoint, privName, dutyName, role.AotName, accessLevel)); }
Related Links
How can you get a detailed error descriptions in Dynamics AX?
How to get the length of an array?
X++ loop through lines in grid control
Concatenating row values in x++
How do you access a macro in the AOT macro node?
How can I set the Backgoundcolor of an AX2012 Action Pane Button
How to Edit address using X++ in AX 2012
Number sequence issue Ax 2012?
Find code that's running in a Batch Job
What is the _isMexican boolean for in the Global::Checkpower method?
AlwaysOnTop property not behaving properly
Boolean AND logic in Microsoft Dynamics AX 2012 AIF QueryCriteria
Table: PrintMgmtSettings Field: Printjobsettings(Blob)
What happened to the hrplimittablerelationship table in ax-2012-r2?
Why is my changes ignored to releaseupdate scripts in dynamics ax 2012 r2
What is “old sys” exactly and why would I receive errors in 2012 because of a missing Macro?