The blog will let you explore how we can use XDS framework in Microsoft Dynamics AX 2012 to restrict user access to data. It enables you to control the accessibility of data a user has, based on desired dimension or attribute.
You can use multiple dimensions to restrict the user access to data in multiple areas of application. We will take the example in which we will use business unit as a dimension or attribute based on which we will restrict the user access to purchase orders.
This will clear your concept about how to use XDS framework in AX 2012 and then you can implement it according to your requirement.
- Create a new Query
- Add Purchline DataSource.
- In PurchLine add DimensionAttributeValueSetItemView DataSource.
- DimensionAttributeValueSetItemView: It provides a simplified query element when querying for its dimension segment values.
- Expand the newly created Data Source DimensionAttributeValueSetItemView, and add a new range on DimensionAttribute field and set (BusinessUnitDimensionAttribute()) in value property.
- BusinessUnitDimensionAttribute() : Function in SysQueryRangeUtil class to get business units assigned to user.
- You can also hardcode any business unit for testing.
- In DimensionAttributeValueSetItemView add MyBusinessUnits Data source. Set Fetch Mode to 1:1 and JoinMode to ExistsJoin.
- MyBusinessUnits: Table contains business units assigned by role.
- Go to security and add a new role XDSSecurity.
- Add roles for all Business units that you want to assign to the users.
- Create a new security policy and set the properties as follows.
- Now go to System administration > Common > Users.
- Select the user and assign XDS security and specific Business Unit role.
- Assign purchasing manager role to see purchase orders.
- Test the scenario, User must have the access to only those purchase orders that belongs to business units you have assigned the roles to him.
- Login from the user you have assigned the role.
- Go to Procurement and sourcing > Purchase orders > All purchase orders.
- Double click on any purchase order.
- In financial dimension tab you can verify that user have the access to only those purchase orders that belongs to business units you have assigned to him.