8.1.3. Permissions
The permission determines the user’s right to any system object or functionality, such as screen, entity operation, etc. The permission can either grant the user the right to the object, or revoke it (in essence, it is actually a prohibition).
Tip
|
By default, the user has the right to an object, unless explicitly denied by a permission. |
The permissions are granted by the sec$Permission
entity instances and contain the following attributes:
-
type
– permission type: determines the object type the permission is imposed on. -
target
– permission object: determines the specific object the permission is imposed on. The format of the attribute depends on the permission type. -
value
– permission value. The value range depends on the permission type.
The permission types are described below:
-
PermissionType.SCREEN
– screen permission.The screen identifier should be specified in the
target
attribute; thevalue
attribute can be 0 or 1 (the screen is denied or allowed, respectively).The screen permissions are checked when building the system main menu and with each invocation of the
openWindow()
,openEditor()
,openLookup()
methods of the Frame interfaces.To check the screen permission in the application code, use the
isScreenPermitted()
method of the Security interface. -
PermissionType.ENTITY_OP
– entity operation permission.The entity name should be specified in the
target
attribute, followed by a colon, and then an operation type:create
,read
,update
,delete
. For example:library$Book:delete
. Thevalue
attribute can be 0 or 1 (the operation is denied or allowed, respectively).The entity operation permissions are checked when working with data through the DataManager, in data aware visual components, and in standard actions, which work with entity lists. As a result, the operation permissions affect the behavior of the client blocks and the REST API. The permissions are not checked when working with data on the Middleware directly via the EntityManager.
To check the entity operation permission in the application code, use the
isEntityOpPermitted()
method of the Security interface. -
PermissionType.ENTITY_ATTR
– entity attribute permission.The entity name should be specified in the
target
attribute, followed by a colon, and then an attribute name. For example:library$Book:name
. Thevalue
attribute can be 0, 1 or 2 (the attribute is hidden, read-only or read-write, respectively).The entity attribute permissions are only checked in the data aware visual components and the REST API.
To check the entity attribute permission in the application code, use the
isEntityAttrPermitted()
method of the Security interface. -
PermissionType.SPECIFIC
– permission on an arbitrary named functionality. Specific permissions can be used instead of roles for binary permitting/denying some project-specific functionality, as roles are designed for aggregating permissions.The functionality identifier should be specified in the
target
attribute; thevalue
attribute can be 0 or 1 (denied or allowed, respectively).Specific permissions for this project are set in the configuration file permissions.xml.
For example:
@Inject private Security security; private void calculateBalance() { if (!security.isSpecificPermitted("myapp.calculateBalance")) return; ... }
-
PermissionType.UI
– arbitrary screen component permission.The screen identifier should be specified in the
target
attribute, followed by a colon, and then a component path. The format of the component path is described in the next section.