How to: Use Roles and Privileges to Restrict Access to a Button
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
You can use the Security section of the AOT to restrict access to specific controls on a form. When a user has access to a form, the default is that the user has access to all the controls on the form. You can override the default by adding permissions nodes for individual controls.
For example, you can set the NeededPermission property on a button to the value Manual to start the process of restricting access to the button control.
You need to understand the following concepts before you can understand this topic:
How to create a form with a button control on it.
How to create a menu item for your form.
How to create a security privilege with an entry point node underneath.
This topic assumes you already have a form, and a node for a corresponding menu item under AOT > Security > Privileges > YourPrivilege > Entry Points. For more information, see Walkthrough: Design Permissions for a Form that is Started from a Menu Item.
Restricting Access to a Button
By following these steps you can restrict access to the button control on the form.
In the AOT, highlight the button control node at Forms > YourForm > Designs > Design > YourButton.
In the Properties window for your button control, set the NeededPermission property to Manual.
This enables you to drag the button node in the next step.
Under the AOT node Forms > YourForm > Permissions > Read > Controls, add YourButton control. Do this by dragging the button node to this Controls node.
In the Properties window for the new permission for YourButton control, set the EffectiveAccess property to Read.
Testing the Restricted Access
In this section you test the security configuration for your control. For more information about the steps in this section, see How to: Test the Role-based Security Configurations under AOT Security.
You can test access to your control by following these steps:
Manually assign an application user to YourTestRole using the System administration form.
Sign on into the system as an application user.
The Workspace window of an application user will contain your menu item.
You should be able to open your form by clicking on your menu item. Notice that the button control appears on the form and you can operate the button.
Sign off from the system as an application user.
Manually remove YourTestRole from an application user using the System administration form.
Sign on into the system as an application user again.
When you open your form again you will notice that your button control no longer appears on the form.
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.