Security on client
There several functions on DWKit client side which allow to check User permissions. Permissions are checked in the open form context.
First method of interaction with security is calling methods of DWKitApp.API
global object. You can find full list of available
functions here.
-
Checking if current user was assigned Role:
var isInRole = DWKitApp.API.checkRole(roleName);
-
Checking if current user has Permission, in Permissions group bound to current form:
var hasPermission = DWKitApp.API.checkPermission(permissionName);
Second method is when we set components in form as uneditable or hide them, depending on Permissions or Roles. Each component in the Other tab has input fields in which Visible condition and ReadOnly condition can be specified. In these fields you can write a function which will return true or false. You can use the following calls in this function:
-
Checking if current user was assigned Role:
checkRole(roleName)
-
Checking if current user has Permission, in Permissions group bound to current form:
checkPermission(permissionName)
Expressions in Visible condition and ReadOnly condition fields must be written exactly as shown above, because they are interpreted as:
return checkRole(roleName);
return checkPermission(permissionName);