Security Jobs related to Dynamics AX 2012 Role Based Security

While working on security setup for one of my client, I need to do some investigations related to security objects. Resulted I have created few jobs that help me in my work. I am sharing here; it may help others also.

Finding all the Privilege related to specific menu items

static void findAllThePrivillageWithSpecificMenuItem(Args _args)
SecurityTask securityTask;
SecuritySubTask securitySubTask;
SecurityTaskEntryPoint SecurityTaskEntryPoint;
SecurableObject SecurableObject;

while select * from SecurityTaskEntryPoint
join SecurableObject
where SecurableObject.RecId == SecurityTaskEntryPoint.EntryPoint
&& SecurableObject.Name == menuitemdisplayStr(ProjGrant)

// 1. How to the find record ID of the privilege
while select * from securityTask
where securityTask.RecId == SecurityTaskEntryPoint.SecurityTask
info(strFmt(“%1,%2,%3,%4”, securityTask.AOTNAME, securityTask.Name, securityTask.Type, SecurityTaskEntryPoint.PermissionGroup));

Finding all the Duties related to specific Privilege

static void findAllTheDutiesWithSpecificPrivilage(Args _args)
SecurityTask securityTask;
SecuritySubTask securitySubTask;

// privilage name

// 1. How to the find record ID of the privilege
select firstOnly RecId from securityTask
where securityTask.AotName == #SecurityTask
&& securityTask.Type == SecurityTaskType::Privilege;

// 2. How to the find all the duties containing the specified privilege
while select SecurityTask from securitySubTask
where securitySubTask.SecuritySubTask == securityTask.RecId
select firstOnly * from securityTask
where securityTask.RecId == securitySubTask.SecurityTask;

info(strFmt(“%1,%2,%3”, securityTask.AOTNAME, securityTask.Name, securityTask.Type));


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: