The ACL module provides methods to check ACLs for modules and fields.
Methods
-
<static> clearCache()
-
This method has no effect. Do not use it.
- Deprecated:
-
- since 7.10
-
<static> hasAccess(action, module [, options])
-
Checks ACLs to see if the current user can perform the given action on a given module or record.
Parameters:
Name Type Argument Description actionstring Action name.
modulestring Module name.
optionsObject <optional>
Options.
Properties
Name Type Argument Description fieldstring <optional>
Name of the field to check access to.
aclsstring <optional>
Record's ACLs that take precedence over the module's ACLs. These are normally supplied by the server as part of the data response in
_acl.Returns:
trueif the current user has access to the givenaction;falseotherwise.- Type
- boolean
-
<static> hasAccessToAny(action)
-
Checks ACLs to see if the current user can perform the given action on any model.
const Acl = require('core/acl'); // Check whether user has `admin` access for any module. Acl.hasAccessToAny('admin'); // Check whether user has `developer` access for any module. Acl.hasAccessToAny('developer');Parameters:
Name Type Description actionstring Action name.
Returns:
trueif the current user has access to the givenaction;falseotherwise.- Type
- boolean
-
<static> hasAccessToModel(action, model [, field])
-
Checks ACLs to see if the current user can perform the given action on a given model's field.
Parameters:
Name Type Argument Description actionstring Action name.
modelObject Model instance.
fieldstring <optional>
Name of the model field.
Returns:
trueif the current user has access to the givenaction;falseotherwise.- Type
- boolean