Using Access Control
The access control list allows you to grant or deny CRUD and custom operation permissions to different roles on instance level. To use ACL in your model, make sure to have the access-control-model as a dependency.
For more information, see Access Control List
On this page
Creating an ACL Model
You can use Control Center to create a model whose entities extend the HasAcl entity. This entity allows you to add a list of ACL entries which control instance-level permissions.
- In Control Center, create a new model which has a dependency to access-control-model. For more information on how to model in Control Center, see Using Modeler.
- Add a new entity type, for example SecureEntity.
- Click the Go To button, search for HasAcland add theHasAclentity type to the Modeler view.
- Create a derivation relation from SecureEntityto theHasAclentity type. This effectively makes your entity extend theHasAclentity, inheriting all of its properties.
- Commit your changes.
Adding ACL Entries
ACL Entries
It is the entries in the list that control the operation permissions for a given role. Each entry must contain:
- an AclPermission - GRANTorDENY
- a role
- an AclOperation
The ACL works by accumulating the effects of the single entries. Entries with an AclPermission.DENY permission are treated with priority over the entries with an AclPermission.GRANT permission for the same operation.
Acl instances are used on and shared amongst HasAcl instances to control access to them.
An AclEntry is a single immutable entry that either grants or a denies a concrete operation for a single role. The standard operations (it is possible to define your own and implement support for it) are given by the AclOperation enum (which is available as a property on AclStandardEntry). The individual constants have the following semantics:
| AclOperation | Controls | 
|---|---|
| READ | read HasAclentity | 
| WRITE | modify existing HasAclentity | 
| DELETE | delete HasAclentity | 
| MODIFY_ACL | modify existing Aclentity | 
| ASSIGN_ACL | assign values to HasAcl.acl | 
Even though an
AclEntrygrants or denies a concrete operation for a single role, you can use$allas the role which applies the given entry to all users. Also bear in mind that when you assign aWRITEpermission for a role, you must assign the same role aREADpermission as well. Otherwise, that particular role will not have read access to the entity instance and the instance will not even be displayed in Control Center.
Note that with ASSIGN_ACL we check the old Acl value which is being overwritten. We do not however check the newly assigned Acl at all, so it is theoretically possible for a user to assign such Acl that the users themselves won't be able to access the entity later.
To add an ACL entry:
- Create an access with the model which has a dependency to access-control-modelas the metamodel.
- Switch to the access in Explorer.
- Create a new instance of an entity type that derives from HasAcl.
- Click the Assign link in the acl line and assign a new instance of acl. A new window opens.
- In the new window, provide a name for your ACL entry and click the Add link in the entries section. A new view is displayed.
- Depending on whether you want to assign ACL to a custom or to a standard operation, select AclCustomEntry or AclStandardEntry.
- In the ACL entry window, assign the operation,permission, androle. Apply and commit your changes.
Deleting Acl and AclEntries
Because of the special utilization of these two types, it is only possible to delete them with the DeleteMode failIfReferenced.
Administrable Metadata
All security checks (except for the Acl and AclEntries deletion) can be overridden with the Administrable meta data. This MD can be configured on HasAcl or Acl types, and is typically configured with a RoleSelector and a UseCaseSelector with use-case being "acl". Obviously, configuring this MD on HasAcl grants rights on any HasAcl sub-type, while on Acl it grants rights to modify the Acl.entries property.
Note that configuring this MD on any sub-type of
HasAclhas no effect, the MD is only resolved onHasAcllevel. For more information, see Administrable.
Quick Summary
The following table summarizes who is authorized to perform a given operation based on how the HasAcl (and in the last row then Acl) entity is configured.
| Operation | acl=owner= null | Only aclset | Only ownerset | Both acl+ownerset | 
|---|---|---|---|---|
| R/W HasAcl.custom | [GRANTED] | READ/WRITE | isOwner | isOwner or READ/WRITE | 
| DELETE HasAcl | [GRANTED] | DELETE | isOwner | isOwner or READ/WRITE | 
| SET HasAcl.owner | [DENIED] | - | isOwner | isOwner | 
| SET HasAcl.acl | [GRANTED] | REPLACE_ACL | isOwner | isOwner or REPLACE_ACL | 
| CHANGE Acl.entries | N/A | MODIFY_ACL | N/A | N/A | 
- MODIFY_ACL implicitly grants the REPLACE_ACL for convenience, but not the others to keep the implementation more maintainable
- We assume Aclalways has some entries. If an instance is created with no entries by a mistake, only a user with administrative privileges (see Administrable) can modify it.
| Annotation | meaning | 
|---|---|
| [GRANTED] | access is allowed to everyone | 
| [DENIED] | access is denied to everyone | 
| READ/WRITE/... | granted if current user has a role which grants given operation, based on the relevant Acl | 
| isOwner | granted if current user is the owner of given HasAclentity | 
| N/A | not a relevant use-case |