Refactoring

Former-commit-id: eb0a3e61043e50467f73782c91dde61944c7bfb0
pull/10/head
Jens Pelzetter 2021-03-03 19:49:04 +01:00
parent 5c2c27e4aa
commit 71f3c07d41
5 changed files with 193 additions and 772 deletions

View File

@ -7,7 +7,6 @@ package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.PermissionChecker;
import org.libreccm.security.PermissionManager; import org.libreccm.security.PermissionManager;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.security.RoleRepository; import org.libreccm.security.RoleRepository;
@ -256,9 +255,7 @@ public class AssetFolderController {
if (parentFolderResult.isPresent()) { if (parentFolderResult.isPresent()) {
parentFolder = parentFolderResult.get(); parentFolder = parentFolderResult.get();
} else { } else {
models.put("contentSection", section.getLabel()); return showAssetFolderNotFound(section, folderName);
models.put("folderPath", parentFolderPath);
return "org/librecms/ui/contentsection/assetfolder/assetfolder-not-found.xhtml";
} }
} }
@ -312,8 +309,9 @@ public class AssetFolderController {
return sectionsUi.showContentSectionNotFound(sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifier);
} }
if (!assetPermissionsChecker.canEditAssets(section)) { if (!assetPermissionsChecker.canEditAssets(section)) {
models.put("sectionidentifier", sectionIdentifier); return sectionsUi.showAccessDenied(
return "org/librecms/ui/contentsection/access-denied.xhtml"; "sectionidentifier", sectionIdentifier
);
} }
final Folder folder; final Folder folder;
@ -332,16 +330,15 @@ public class AssetFolderController {
assetFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath)); assetFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath));
} else { } else {
models.put("contentSection", section.getLabel()); return showAssetFolderNotFound(section, folderPath);
models.put("folderPath", folderPath);
return "org/librecms/ui/contentsection/assestfolder/assetfolder-not-found.xhtml";
} }
} }
if (!assetPermissionsChecker.canEditAssets(folder)) { if (!assetPermissionsChecker.canEditAssets(folder)) {
models.put("sectionidentifier", sectionIdentifier); return sectionsUi.showAccessDenied(
models.put("folderPath", folderPath); "sectionidentifier", sectionIdentifier,
return "org/librecms/ui/contentsection/access-denied.xhtml"; "folderPath", folderPath
);
} }
final Optional<Role> roleResult = roleRepo.findByName(roleParam); final Optional<Role> roleResult = roleRepo.findByName(roleParam);
@ -395,8 +392,9 @@ public class AssetFolderController {
return sectionsUi.showContentSectionNotFound(sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifier);
} }
if (!assetPermissionsChecker.canEditAssets(section)) { if (!assetPermissionsChecker.canEditAssets(section)) {
models.put("sectionidentifier", sectionIdentifier); return sectionsUi.showAccessDenied(
return "org/librecms/ui/contentsection/access-denied.xhtml"; "sectionidentifier", sectionIdentifier
);
} }
final Folder folder; final Folder folder;
@ -411,15 +409,14 @@ public class AssetFolderController {
assetFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath)); assetFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath));
} else { } else {
models.put("contentSection", section.getLabel()); return showAssetFolderNotFound(section, folderPath);
models.put("folderPath", folderPath);
return "org/librecms/ui/contentsection/assetfolder/assetfolder-not-found.xhtml";
} }
if (!assetPermissionsChecker.canEditAssets(folder)) { if (!assetPermissionsChecker.canEditAssets(folder)) {
models.put("sectionidentifier", sectionIdentifier); return sectionsUi.showAccessDenied(
models.put("folderPath", folderPath); "sectionidentifier", sectionIdentifier,
return "org/librecms/ui/contentsection/access-denied.xhtml"; "folderPath", folderPath
);
} }
folder.setName(folderName); folder.setName(folderName);

View File

@ -39,6 +39,9 @@ public class ConfigurationController {
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
@Inject
private ContentSectionsUi sectionsUi;
@Inject @Inject
private IdentifierParser identifierParser; private IdentifierParser identifierParser;
@ -55,43 +58,19 @@ public class ConfigurationController {
public String showConfigurationIndexPage( public String showConfigurationIndexPage(
@PathParam("sectionIdentifier") final String sectionIdentifierParam @PathParam("sectionIdentifier") final String sectionIdentifierParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!hasRequiredPermission(section)) { if (!hasRequiredPermission(section)) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showAccessDenied(
return "org/librecms/ui/contentsection/access-denied.xhtml"; "sectionIdentifier", sectionIdentifierParam
);
} }
return "org/librecms/ui/contentsection/configuration/index.xhtml"; return "org/librecms/ui/contentsection/configuration/index.xhtml";
} }
@ -105,7 +84,8 @@ public class ConfigurationController {
|| permissionChecker.isPermitted( || permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_ROLES, section AdminPrivileges.ADMINISTER_ROLES, section
) )
|| permissionChecker.isPermitted(AdminPrivileges.ADMINISTER_WORKFLOWS, section || permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_WORKFLOWS, section
); );
} }

View File

@ -53,6 +53,9 @@ import javax.ws.rs.PathParam;
@Path("/{sectionIdentifier}/configuration/documenttypes") @Path("/{sectionIdentifier}/configuration/documenttypes")
public class ConfigurationDocumentTypesController { public class ConfigurationDocumentTypesController {
@Inject
private AdminPermissionsChecker adminPermissionsChecker;
@Inject @Inject
private CmsAdminMessages cmsAdminMessages; private CmsAdminMessages cmsAdminMessages;
@ -63,7 +66,7 @@ public class ConfigurationDocumentTypesController {
private ContentSectionManager sectionManager; private ContentSectionManager sectionManager;
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionsUi sectionsUi;
@Inject @Inject
private ContentTypeManager typeManager; private ContentTypeManager typeManager;
@ -99,43 +102,17 @@ public class ConfigurationDocumentTypesController {
public String listDocumentTypes( public String listDocumentTypes(
@PathParam("sectionIdentifier") final String sectionIdentifierParam @PathParam("sectionIdentifier") final String sectionIdentifierParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!adminPermissionsChecker.canAdministerContentTypes(section)) {
if (!permissionChecker.isPermitted( return sectionsUi.showAccessDenied(
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section "sectionIdentifier", sectionIdentifierParam
)) { );
models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
documentTypesModel.setAssignedTypes( documentTypesModel.setAssignedTypes(
@ -201,43 +178,17 @@ public class ConfigurationDocumentTypesController {
@FormParam("defaultLifecycleUuid") final String defaultLifecycleUuid, @FormParam("defaultLifecycleUuid") final String defaultLifecycleUuid,
@FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid @FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!adminPermissionsChecker.canAdministerContentTypes(section)) {
if (!permissionChecker.isPermitted( return sectionsUi.showAccessDenied(
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section "sectionIdentifier", sectionIdentifierParam
)) { );
models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<ContentTypeInfo> typeInfo = typesManager final Optional<ContentTypeInfo> typeInfo = typesManager
@ -309,113 +260,6 @@ public class ConfigurationDocumentTypesController {
); );
} }
// @GET
// @Path("/{documentType}")
// public String showDocumentType(
// @PathParam("sectionIdentifier") final String sectionIdentifierParam,
// @PathParam("documentType") final String documentTypeParam
// ) {
// final Identifier sectionIdentifier = identifierParser.parseIdentifier(
// sectionIdentifierParam
// );
//
// final Optional<ContentSection> sectionResult;
// switch (sectionIdentifier.getType()) {
// case ID:
// sectionResult = sectionRepo.findById(
// Long.parseLong(
// sectionIdentifier.getIdentifier()
// )
// );
// break;
// case UUID:
// sectionResult = sectionRepo.findByUuid(
// sectionIdentifier.getIdentifier()
// );
// break;
// default:
// sectionResult = sectionRepo.findByLabel(
// sectionIdentifier.getIdentifier()
// );
// break;
// }
//
// if (!sectionResult.isPresent()) {
// models.put("sectionIdentifier", sectionIdentifier);
// return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
// }
// final ContentSection section = sectionResult.get();
// sectionModel.setSection(section);
//
// if (!permissionChecker.isPermitted(
// AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
// )) {
// models.put("sectionIdentifier", sectionIdentifier);
// return "org/librecms/ui/contentsection/access-denied.xhtml";
// }
//
// final Optional<ContentType> typeResult = section
// .getContentTypes()
// .stream()
// .filter(type -> type.getContentItemClass().equals(documentTypeParam))
// .findAny();
//
// if (!typeResult.isPresent()) {
// return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
// }
//
// final ContentType type = typeResult.get();
//
// documentTypeModel.setContentItemClass(sectionIdentifierParam);
// documentTypeModel.setDescriptions(
// type
// .getDescription()
// .getValues()
// .entrySet()
// .stream()
// .collect(Collectors.toMap(
// entry -> entry.getKey().toString(),
// entry -> entry.getValue()
// ))
// );
// documentTypeModel.setLabels(
// type
// .getLabel()
// .getValues()
// .entrySet()
// .stream()
// .collect(Collectors.toMap(
// entry -> entry.getKey().toString(),
// entry -> entry.getValue()
// ))
// );
//
// final LifecycleDefinition defaultLifecycle = type.getDefaultLifecycle();
// documentTypeModel.setLifecycles(
// section
// .getLifecycleDefinitions()
// .stream()
// .map(
// def -> buildLifecycleModel(
// def, def.equals(defaultLifecycle)
// )
// ).collect(Collectors.toList())
// );
//
// final Workflow defaultWorkflow = type.getDefaultWorkflow();
// documentTypeModel.setWorkflows(
// section
// .getWorkflowTemplates()
// .stream()
// .map(
// template -> buildWorkflowModel(
// template, template.equals(defaultWorkflow)
// )
// ).collect(Collectors.toList())
// );
//
// return "org/librecms/ui/contentsection/configuration/documenttype.xhtml";
// }
@POST @POST
@Path("/{documentType}") @Path("/{documentType}")
@AuthorizationRequired @AuthorizationRequired
@ -427,43 +271,17 @@ public class ConfigurationDocumentTypesController {
@FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid, @FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid,
@FormParam("roleUuids") final Set<String> roleUuids @FormParam("roleUuids") final Set<String> roleUuids
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!adminPermissionsChecker.canAdministerContentTypes(section)) {
if (!permissionChecker.isPermitted( return sectionsUi.showAccessDenied(
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section "sectionIdentifier", sectionIdentifierParam
)) { );
models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<ContentType> typeResult = section final Optional<ContentType> typeResult = section
@ -625,43 +443,17 @@ public class ConfigurationDocumentTypesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("documentType") final String documentTypeParam @PathParam("documentType") final String documentTypeParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!adminPermissionsChecker.canAdministerContentTypes(section)) {
if (!permissionChecker.isPermitted( return sectionsUi.showAccessDenied(
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section "sectionIdentifier", sectionIdentifierParam
)) { );
models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<ContentType> typeResult = section final Optional<ContentType> typeResult = section

View File

@ -7,12 +7,10 @@ package org.librecms.ui.contentsections;
import org.libreccm.api.Identifier; import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser; import org.libreccm.api.IdentifierParser;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.Party; import org.libreccm.security.Party;
import org.libreccm.security.PartyRepository; import org.libreccm.security.PartyRepository;
import org.libreccm.security.Permission;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.libreccm.security.PermissionManager; import org.libreccm.security.PermissionManager;
import org.libreccm.security.Role; import org.libreccm.security.Role;
@ -33,7 +31,6 @@ import javax.ws.rs.PathParam;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionManager; import org.librecms.contentsection.ContentSectionManager;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.Folder; import org.librecms.contentsection.Folder;
import org.librecms.contentsection.privileges.AdminPrivileges; import org.librecms.contentsection.privileges.AdminPrivileges;
import org.librecms.contentsection.privileges.AssetPrivileges; import org.librecms.contentsection.privileges.AssetPrivileges;
@ -58,6 +55,9 @@ import javax.ws.rs.POST;
@Path("/{sectionIdentifier}/configuration/roles") @Path("/{sectionIdentifier}/configuration/roles")
public class ConfigurationRolesController { public class ConfigurationRolesController {
@Inject
private AdminPermissionsChecker adminPermissionsChecker;
@Inject @Inject
private CmsAdminMessages messages; private CmsAdminMessages messages;
@ -67,8 +67,10 @@ public class ConfigurationRolesController {
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
// @Inject
// private ContentSectionRepository sectionRepo;
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionsUi sectionsUi;
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
@ -104,43 +106,19 @@ public class ConfigurationRolesController {
public String listRoles( public String listRoles(
@PathParam("sectionIdentifier") final String sectionIdentifierParam @PathParam("sectionIdentifier") final String sectionIdentifierParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final List<Role> sectionRoles = section.getRoles(); final List<Role> sectionRoles = section.getRoles();
@ -179,43 +157,18 @@ public class ConfigurationRolesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("roleName") final String roleName @PathParam("roleName") final String roleName
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -225,9 +178,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -278,43 +229,18 @@ public class ConfigurationRolesController {
@PathParam("roleName") final String roleName, @PathParam("roleName") final String roleName,
@FormParam("roleName") final String newRoleName @FormParam("roleName") final String newRoleName
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -324,9 +250,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -349,43 +273,18 @@ public class ConfigurationRolesController {
@PathParam("roleName") final String roleName, @PathParam("roleName") final String roleName,
@FormParam("grantedPermissions") final List<String> grantedPermissions @FormParam("grantedPermissions") final List<String> grantedPermissions
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -395,9 +294,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -458,43 +355,18 @@ public class ConfigurationRolesController {
@PathParam("roleName") final String roleName, @PathParam("roleName") final String roleName,
@FormParam("roleMembers") final List<String> roleMembersParam @FormParam("roleMembers") final List<String> roleMembersParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -504,9 +376,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -550,43 +420,18 @@ public class ConfigurationRolesController {
@FormParam("locale") final String localeParam, @FormParam("locale") final String localeParam,
@FormParam("value") final String value @FormParam("value") final String value
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -596,9 +441,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -623,43 +466,18 @@ public class ConfigurationRolesController {
@PathParam("locale") final String localeParam, @PathParam("locale") final String localeParam,
@FormParam("value") final String value @FormParam("value") final String value
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -669,9 +487,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -696,43 +512,18 @@ public class ConfigurationRolesController {
@PathParam("locale") final String localeParam, @PathParam("locale") final String localeParam,
@FormParam("value") final String value @FormParam("value") final String value
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final Optional<Role> result = section final Optional<Role> result = section
@ -742,9 +533,7 @@ public class ConfigurationRolesController {
.findAny(); .findAny();
if (!result.isPresent()) { if (!result.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return showRoleNotFound(section, roleName);
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = result.get(); final Role role = result.get();
@ -766,43 +555,18 @@ public class ConfigurationRolesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@FormParam("roleName") final String roleName @FormParam("roleName") final String roleName
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
final List<String> errors = new ArrayList<>(); final List<String> errors = new ArrayList<>();
@ -841,43 +605,18 @@ public class ConfigurationRolesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@FormParam("rolesToAdd") final List<String> rolesToAdd @FormParam("rolesToAdd") final List<String> rolesToAdd
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
for (final String roleUuid : rolesToAdd) { for (final String roleUuid : rolesToAdd) {
@ -903,71 +642,24 @@ public class ConfigurationRolesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("roleIdentifier") final String roleIdentifierParam @PathParam("roleIdentifier") final String roleIdentifierParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier(
sectionIdentifierParam
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifierParam);
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
}
final Identifier roleIdentifier = identifierParser.parseIdentifier(
roleIdentifierParam
);
final Optional<Role> roleResult;
switch (roleIdentifier.getType()) {
case ID:
roleResult = roleRepo.findById(
Long.parseLong(roleIdentifier.getIdentifier())
);
break;
case UUID:
roleResult = roleRepo.findByUuid(
roleIdentifier.getIdentifier()
);
break;
default:
roleResult = roleRepo.findByName(
roleIdentifier.getIdentifier()
);
break;
} }
final Optional<Role> roleResult = findRole(roleIdentifierParam);
if (!roleResult.isPresent()) { if (!roleResult.isPresent()) {
models.put("roleIdentifier", roleIdentifierParam); return showRoleNotFound(section, roleIdentifierParam);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = roleResult.get(); final Role role = roleResult.get();
sectionManager.removeRoleFromContentSection(section, role); sectionManager.removeRoleFromContentSection(section, role);
@ -985,71 +677,23 @@ public class ConfigurationRolesController {
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("roleIdentifier") final String roleIdentifierParam @PathParam("roleIdentifier") final String roleIdentifierParam
) { ) {
final Identifier sectionIdentifier = identifierParser.parseIdentifier( final Optional<ContentSection> sectionResult = sectionsUi
sectionIdentifierParam .findContentSection(sectionIdentifierParam);
);
final Optional<ContentSection> sectionResult;
switch (sectionIdentifier.getType()) {
case ID:
sectionResult = sectionRepo.findById(
Long.parseLong(
sectionIdentifier.getIdentifier()
)
);
break;
case UUID:
sectionResult = sectionRepo.findByUuid(
sectionIdentifier.getIdentifier()
);
break;
default:
sectionResult = sectionRepo.findByLabel(
sectionIdentifier.getIdentifier()
);
break;
}
if (!sectionResult.isPresent()) { if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier); return sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
final ContentSection section = sectionResult.get(); final ContentSection section = sectionResult.get();
sectionModel.setSection(section); sectionModel.setSection(section);
if (!permissionChecker.isPermitted( if (!adminPermissionsChecker.canAdministerRoles(section)) {
AdminPrivileges.ADMINISTER_ROLES, section return sectionsUi.showAccessDenied(
)) { "sectionIdentifier", sectionIdentifierParam
models.put("sectionIdentifier", sectionIdentifier); );
return "org/librecms/ui/contentsection/access-denied.xhtml";
}
final Identifier roleIdentifier = identifierParser.parseIdentifier(
roleIdentifierParam
);
final Optional<Role> roleResult;
switch (roleIdentifier.getType()) {
case ID:
roleResult = roleRepo.findById(
Long.parseLong(roleIdentifier.getIdentifier())
);
break;
case UUID:
roleResult = roleRepo.findByUuid(
roleIdentifier.getIdentifier()
);
break;
default:
roleResult = roleRepo.findByName(
roleIdentifier.getIdentifier()
);
break;
} }
final Optional<Role> roleResult = findRole(roleIdentifierParam);
if (!roleResult.isPresent()) { if (!roleResult.isPresent()) {
models.put("roleIdentifier", roleIdentifierParam); return showRoleNotFound(section, roleIdentifierParam);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
final Role role = roleResult.get(); final Role role = roleResult.get();
sectionManager.removeRoleFromContentSection(section, role); sectionManager.removeRoleFromContentSection(section, role);
@ -1060,6 +704,34 @@ public class ConfigurationRolesController {
); );
} }
private Optional<Role> findRole(final String roleIdentifierParam) {
final Identifier roleIdentifier = identifierParser.parseIdentifier(
roleIdentifierParam
);
switch (roleIdentifier.getType()) {
case ID:
return roleRepo.findById(
Long.parseLong(roleIdentifier.getIdentifier())
);
case UUID:
return roleRepo.findByUuid(
roleIdentifier.getIdentifier()
);
default:
return roleRepo.findByName(
roleIdentifier.getIdentifier()
);
}
}
private String showRoleNotFound(
final ContentSection section, final String roleName
) {
models.put("sectionIdentifier", section.getLabel());
models.put("roleName", roleName);
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
}
private RoleListItemModel buildRoleListModel(final Role role) { private RoleListItemModel buildRoleListModel(final Role role) {
final RoleListItemModel model = new RoleListItemModel(); final RoleListItemModel model = new RoleListItemModel();
model.setRoleId(role.getRoleId()); model.setRoleId(role.getRoleId());
@ -1083,18 +755,6 @@ public class ConfigurationRolesController {
return model; return model;
} }
private boolean onlyContentSectionPermissions(
final Permission permission, final ContentSection section
) {
final Folder rootDocumentsFolder = section.getRootDocumentsFolder();
final Folder rootAssetsFolder = section.getRootAssetsFolder();
final CcmObject object = permission.getObject();
return section.equals(object)
|| rootDocumentsFolder.equals(object)
|| rootAssetsFolder.equals(object);
}
private List<RoleSectionPermissionModel> buildRolePermissions( private List<RoleSectionPermissionModel> buildRolePermissions(
final Role role, final ContentSection section final Role role, final ContentSection section
) { ) {

View File

@ -7,7 +7,6 @@ package org.librecms.ui.contentsections;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser; import org.libreccm.api.IdentifierParser;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
@ -20,7 +19,6 @@ import org.librecms.contentsection.ContentItemL10NManager;
import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository; import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import org.librecms.contentsection.ContentTypeRepository; import org.librecms.contentsection.ContentTypeRepository;
import org.librecms.contentsection.DocumentFolderEntry; import org.librecms.contentsection.DocumentFolderEntry;
@ -105,12 +103,6 @@ public class DocumentFolderController {
@Inject @Inject
private Models models; private Models models;
@Inject
private IdentifierParser identifierParser;
@Inject
private PermissionChecker permissionChecker;
@Inject @Inject
private PermissionManager permissionManager; private PermissionManager permissionManager;