/
Access Right Service (java)
NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Access Right Service (java)
List of all options:
Get list of all builtin permissions or a single permission.
Get list of all builtin roles
Create, read, update and delete a custom role
Initialize service
TrivoreID sdk = TrivoreID.mgmtApiClient();
AccessRightServiceImpl accessRightService = new AccessRightServiceImpl(sdk.accessRightService());
Getting access right objects
// get list with all builtin permissions.
List<Permission> permissions = accessRightService.getAllPermissions();
// get a single permission
Permission permission = accessRightService.getPermission("permissionId");
// get list with all builtin roles.
List<BuiltInRole> builtInRoles = accessRightService.getAllBuiltinRoles();
// get first five custom roles belonging to namespace 'examplecode'
Criteria criteria = new Criteria(Filter.equal("nsCode", "examplecode"));
Page<CustomRole> roles = accessRightService.getAllCustomRoles();
Managing access right objects
// create new custom role
CustomRole role = new CustomRole();
role.getMemberOf().add("groupId1");
role.getMemberOf().add("groupId2");
role.setName("EXAMPLE_ROLE");
// the function returns custom role object with the generated id
role = accessRightService.createCustomRole(role);
// update custom role
role.setName("MODIFIED_NAME");
accessRightService.updateCustomRole(role);
// get custom role
role = accessRightService.getCustomRole(role.getId());
// delete custom role
accessRightService.deleteCustomRole(role.getId());