The ACLService service displays various operations you can perform on ACLs:
-
getretrieves all ACLs in the scope. -
createcreates a list ofsecurityObjects. The list of objects must be supplied as input, before they can be created in the application. -
getForComponentretrieves a component's ACL from the component's category and identifier. -
getByIdretrieves ACLs from the list of their identifiers. -
updateByIdupdates ACLs using their identifiers. -
deleteByIddeletes ACLs based on their identifiers.
ACL recovery
The examples below show how to retrieve ACLs using the various operations of get.
GET:
- REST
- JAVA
GET {{core}}/rest/acl/ HTTP/1.1
-- URL parameters --
core: FlowerDocs Core host
-- Headers --
token: {{token}}
Content-Type: application/json
@Autowired
private ACLService service;
public List<SecurityObject> getAllAcl() throws TechnicalException, FunctionalException
return service.getAll();
GET FOR COMPONENT:
- REST
- JAVA
GET {{core}}/rest/acl/{category}/{ids} HTTP/1.1
-- URL parameters
core: FlowerDocs Core host
category: component category
ids: component identifier
-- Headers --
token: {{token}}
Content-Type: application/json
@Autowired
private ACLService service;
public SecurityObject getForComponentAcl() throws FunctionalException, TechnicalException
ComponentReference component = new ComponentReference();
component.setId(new Id("c1ec8407-c1ba-4802-bc03-a99c9cfb5b9e"));
component.setCategory(Category.DOCUMENT);
return service.getForComponent(component);
GET BY ID:
- REST
- JAVA
GET {{core}}/rest/acl/{ids} HTTP/1.1
-- URL parameters --
core: FlowerDocs Core host
-- Headers --
token: {{token}}
Content-Type: application/json
@Autowired
private ACLService service;
public List<SecurityObject> get() throws FunctionalException, TechnicalException
List<Id> ids = Lists.newArrayList(new Id("acl-admin"));
return service.get(ids);
ACL creation
The examples below show how to create ACLs using the operation of create.
- REST
- JAVA
POST {{core}}/rest/acl/ HTTP/1.1
-- URL parameters --
core: FlowerDocs Core host
-- Headers --
token: {{token}}
Content-Type: application/json
-- Body (json) --
[
"entries": [
"principal": "*",
"permission": "UPDATE_CONTENT",
"grant": "ALLOW"
}],
"id": "acl_test",
"name": "ACL test"
]
@Autowired
private ACLService service;
public List<SecurityObject> create() throws FunctionalException, TechnicalException
AccessControlEntry ace = new AccessControlEntry(Lists.newArrayList("*"),
Lists.newArrayList(Permission.UPDATE_CONTENT), GrantType.ALLOW);
SecurityObject acl = new AccessControlList(new Id("acl_test"), "ACL Test", Lists.newArrayList(ace));
List<SecurityObject> acls = Lists.newArrayList(acl);
return service.create(acls);
ACL modification
The examples below show how to update ACLs using the operation ofupdate.
- REST
- JAVA
POST {{core}}/rest/acl/{ids} HTTP/1.1
-- URL parameters --
core: FlowerDocs Core host
ids: identifiers of ACLs to be modified
-- Headers --
token: {{token}}
Content-Type: application/json
-- Body (json)
[
"entries": [
"principal": "*",
"permission": "UPDATE_CONTENT",
"grant": "DENY"
}],
"id": "acl_test",
"name": "ACL test"
]
@Autowired
private ACLService service;
public List<SecurityObject> update() throws FunctionalException, TechnicalException
AccessControlEntry ace = new AccessControlEntry(Lists.newArrayList("*"),
Lists.newArrayList(Permission.UPDATE_CONTENT), GrantType.DENY);
SecurityObject acl = new AccessControlList(new Id("acl-courrier-outgoing"), "Outgoing mail security",
Lists.newArrayList(ace));
List<SecurityObject> acls = Lists.newArrayList(acl);
return service.update(acls);
Deleting ACL
The examples below show how to delete ACLs using the operation of delete.
- REST
- JAVA
DELETE {{core}}/rest/acl/{ids} HTTP/1.1
-- URL parameters --
core: FlowerDocs Core host
ids: identifiers of ACLs to be deleted
-- Headers --
token: {{token}}
Content-Type: application/json
@Autowired
private ACLService service;
public void delete() throws FunctionalException, TechnicalException
List<Id> ids = Lists.newArrayList(new Id("acl_test"));
service.delete(ids);