use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.
the class IdProviderNodeTranslator method idProviderPermissionsToUsersNodePermissions.
static AccessControlList idProviderPermissionsToUsersNodePermissions(final IdProviderAccessControlList idProviderPermissions) {
final List<AccessControlEntry> entries = new ArrayList<>();
for (IdProviderAccessControlEntry entry : idProviderPermissions) {
final AccessControlEntry ace;
switch(entry.getAccess()) {
case CREATE_USERS:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(CREATE).build();
entries.add(ace);
break;
case WRITE_USERS:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE).build();
entries.add(ace);
break;
case ID_PROVIDER_MANAGER:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE).build();
entries.add(ace);
break;
case ADMINISTRATOR:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE, PUBLISH, READ_PERMISSIONS, WRITE_PERMISSIONS).build();
entries.add(ace);
break;
case READ:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ).build();
entries.add(ace);
break;
}
}
return AccessControlList.create().addAll(entries).build();
}
use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.
the class IdProviderNodeTranslator method idProviderPermissionsToGroupsNodePermissions.
static AccessControlList idProviderPermissionsToGroupsNodePermissions(final IdProviderAccessControlList idProviderPermissions) {
final List<AccessControlEntry> entries = new ArrayList<>();
for (IdProviderAccessControlEntry entry : idProviderPermissions) {
final AccessControlEntry ace;
switch(entry.getAccess()) {
case ID_PROVIDER_MANAGER:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE).build();
entries.add(ace);
break;
case ADMINISTRATOR:
ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE, PUBLISH, READ_PERMISSIONS, WRITE_PERMISSIONS).build();
entries.add(ace);
break;
}
}
return AccessControlList.create().addAll(entries).build();
}
use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.
the class IdProviderNodeTranslator method idProviderPermissionsToIdProviderNodePermissions.
static AccessControlList idProviderPermissionsToIdProviderNodePermissions(final IdProviderAccessControlList idProviderPermissions) {
final List<AccessControlEntry> entries = new ArrayList<>();
for (IdProviderAccessControlEntry entry : idProviderPermissions) {
if (entry.getAccess() == ADMINISTRATOR) {
final AccessControlEntry ace = AccessControlEntry.create().principal(entry.getPrincipal()).allow(READ, CREATE, MODIFY, DELETE, PUBLISH, READ_PERMISSIONS, WRITE_PERMISSIONS).build();
entries.add(ace);
}
}
return AccessControlList.create().addAll(entries).build();
}
use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.
the class SecurityInitializer method initializeIdProviderParentFolder.
private void initializeIdProviderParentFolder() {
final NodePath idProviderParentNodePath = IdProviderNodeTranslator.getIdProvidersParentPath();
LOG.info("Initializing [" + idProviderParentNodePath.toString() + "] folder");
final AccessControlEntry userManagerFullAccess = AccessControlEntry.create().allowAll().principal(RoleKeys.USER_MANAGER_ADMIN).build();
final ChildOrder childOrder = ChildOrder.create().add(FieldOrderExpr.create(NodeIndexPath.NAME, OrderExpr.Direction.ASC)).build();
nodeService.create(CreateNodeParams.create().parent(idProviderParentNodePath.getParentPath()).name(idProviderParentNodePath.getLastElement().toString()).permissions(AccessControlList.create().addAll(SystemConstants.SYSTEM_REPO_DEFAULT_ACL.getEntries()).add(userManagerFullAccess).build()).inheritPermissions(false).childOrder(childOrder).build());
}
use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.
the class ContentAuditLogSupportImpl method doApplyPermissions.
private void doApplyPermissions(final ApplyContentPermissionsParams params, final ApplyContentPermissionsResult result, final Context rootContext) {
final PropertyTree data = new PropertyTree();
final PropertySet paramsSet = data.addSet("params");
final PropertySet resultSet = data.addSet("result");
paramsSet.addString("contentId", nullToNull(params.getContentId()));
paramsSet.addBoolean("inheritPermissions", params.isInheritPermissions());
paramsSet.addBoolean("overwriteChildPermissions", params.isOverwriteChildPermissions());
if (params.getPermissions() != null) {
paramsSet.addStrings("permissions", params.getPermissions().getEntries().stream().map(AccessControlEntry::toString).collect(Collectors.toList()));
}
addContents(resultSet, result.getSkippedContents(), "skippedContents");
addContents(resultSet, result.getSucceedContents(), "succeedContents");
log("system.content.applyPermissions", data, result.getSucceedContents(), rootContext);
}
Aggregations