Anda di halaman 1dari 8

Creating a new POS Permission for AX Retail 6.

2

Overview
Permissions are the way that AX for Retail 6.2 enforces role-based feature access in the POS client.
Permissions can be associated with POS operations and automatically evaluated at run-time to
determine if the current operator has the requisite feature-access to perform the operation.
Additionally, using the extensibility framework in POS, ISVs can check Permissions from their own
custom modules.
Data model
RetailPosPermissionsGroup table
This table is the target of all Permissions. Each permission check will resolve to the look-up
and evaluation of a boolean column on the RetailPosPermissionGroup table.
RetailPermissions table
This table is the definition of the Permission, defining the way by which other systems refer to it,
as well as providing the mapping to the permission target in the RetailPosPermissionsGroup
table. The PermissionId is used to call the UserAccessSystem module to evaluate the
Permission at run-time.
RetailOperations table
This table is primarily used for defining Operations that appear in the POS client UI, but includes
fields for associating a primary (Permission ID) and secondary (Permission ID2) Permission that
will be automatically evaluated when the Operation is invoked at run-time. The Check user
access column is used to enable/disable Permission evaluation for the operation; the defined
Permissions are ONLY evaluated in the POS client if Check user access is checked.

Creating a new permission target
1. Add new column to RetailPosPermissionGroup table in AX. It should be a Boolean/NoYes
enum.
a. In this example we create a field called salesRepPrivileges.



2. Drag the new column to the Permissions field group


3. Add new column to the POS db
a. Create and execute a SQL script similar to the following on each POS db:
ALTER TABLE RETAILPOSPERMISSIONGROUP
ADD
[SALESREPPRIVILEGES] [int] NULL
GO

4. Include new column in Store Connect jobs

a. Add new field to Retail channel schema
i. AX > CEU > Retail > Setup > Retail scheduler > Retail channel schema

ii. Click on Location tables
iii. Select the RetailPosPermissionGroup table

iv. Click on Location fields and add a new row for the new POS db column


b. Add the new field to the relevant scheduler subjobs
i. Select RetailPosPermissionGroup jobs


ii. Click Transfer field list
iii. Click New and specify From field and To field


Create a new permission
1. Navigate to AX > CEU > Retail > Setup > POS > Profiles > Permission groups
2. Click New to add new record
3. Specify unique value for Permission Id
4. Specify the permission target column from RetailPosPermissionGroup table

Associate an operation with a permission
1. Navigate to AX > CEU > Retail > Setup > POS > Profiles > Operations
2. Edit Operation record
3. Select the newly created Permission Id from the dropdown for either the Permission Id or
Permission Id2 columns.


Evaluate a permission from custom code
1. Get reference to UserAccessSystem service instance.
2. Call .UserHasPermission() passing the PermissionID value defined above.
IApplication application = this.InternalApplication;
IUserAccessSystem userAccess = application.BusinessLogic.UserAccessSystem;
string userId = "10001";
int permissionId = 2001;
bool hasPermission = userAccess.UserHasPermission(userId, permissionId);

Anda mungkin juga menyukai