From 8aa371571deca921cfec19adcaba0378e113935c Mon Sep 17 00:00:00 2001
From: Jens Pelzetter
Date: Wed, 3 Feb 2021 20:26:22 +0100
Subject: [PATCH] Some refactoring, and permissions checks
Former-commit-id: 65ef6af3369dd471ed012d09028db7d25112f7fa
---
.../privileges/ItemPrivileges.java | 78 +--
.../DocumentFolderController.java | 464 +++++++++++-------
.../contentsections/DocumentFolderModel.java | 11 +-
.../DocumentFolderRowModel.java | 12 +
.../ui/contentsections/FolderTreeNode.java | 33 +-
.../contentsections/ItemPermissionsModel.java | 115 +++++
.../document-folder-tree-node.xhtml | 12 +-
.../documentfolder/documentfolder.xhtml | 185 ++++---
.../org/librecms/CmsAdminMessages.properties | 2 +
.../librecms/CmsAdminMessages_de.properties | 2 +
10 files changed, 612 insertions(+), 302 deletions(-)
create mode 100644 ccm-cms/src/main/java/org/librecms/ui/contentsections/ItemPermissionsModel.java
diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/privileges/ItemPrivileges.java b/ccm-cms/src/main/java/org/librecms/contentsection/privileges/ItemPrivileges.java
index ce759b3f7..abc299ee0 100644
--- a/ccm-cms/src/main/java/org/librecms/contentsection/privileges/ItemPrivileges.java
+++ b/ccm-cms/src/main/java/org/librecms/contentsection/privileges/ItemPrivileges.java
@@ -22,7 +22,7 @@ import org.librecms.contentsection.ContentItem;
/**
* Constants for privileges allowing actions on the items of a content section.
- * All privileges defined in this class can either be assigned for the complete
+ * All privileges defined in this class can either be assigned for the complete
* {@link ContentSection} or for a specific documents/items {@link Folder}.
*
* @author Jens Pelzetter
@@ -33,45 +33,53 @@ public final class ItemPrivileges {
* Allows the user to edit the permissions for items.
*/
public static final String ADMINISTER = "administer_items";
-
- /**
- * Allows the user to approve {@link ContentItem}s.
- */
- public static final String APPROVE = "approve_items";
- /**
- * Allows the user to publish, republish and unpublish {@link ContentItem}.
- */
- public static final String PUBLISH = "publish_items";
- /**
- * Allows the user to categorise {@link ContentItem}s.
- */
- public static final String CATEGORIZE = "categorize_items";
- /**
- * Allows the user to create new {@link ContentItem}s.
- */
- public static final String CREATE_NEW = "create_new_items";
- /**
- * Allows the user to delete {@link ContentItem}s.
- */
- public static final String DELETE = "delete_items";
- /**
- * Allows the user to edit existing {@link ContentItem}s.
- */
- public static final String EDIT = "edit_items";
- /**
- * Allows to user to view the draft version of {@link ContentItem}.
- */
- public static final String PREVIEW = "preview_items";
- /**
- * Allows the user to view the live version of {@link ContentItems}.
- */
- public static final String VIEW_PUBLISHED = "view_published_items";
+
/**
* Allows the user to apply another {@link Workflow} than the default one to
* an {@link ContentItem}.
*/
public static final String APPLY_ALTERNATE_WORKFLOW
- = "apply_alternate_workflow";
+ = "apply_alternate_workflow";
+
+ /**
+ * Allows the user to approve {@link ContentItem}s.
+ */
+ public static final String APPROVE = "approve_items";
+
+ /**
+ * Allows the user to categorise {@link ContentItem}s.
+ */
+ public static final String CATEGORIZE = "categorize_items";
+
+ /**
+ * Allows the user to create new {@link ContentItem}s.
+ */
+ public static final String CREATE_NEW = "create_new_items";
+
+ /**
+ * Allows the user to delete {@link ContentItem}s.
+ */
+ public static final String DELETE = "delete_items";
+
+ /**
+ * Allows the user to edit existing {@link ContentItem}s.
+ */
+ public static final String EDIT = "edit_items";
+
+ /**
+ * Allows to user to view the draft version of {@link ContentItem}.
+ */
+ public static final String PREVIEW = "preview_items";
+
+ /**
+ * Allows the user to publish, republish and unpublish {@link ContentItem}.
+ */
+ public static final String PUBLISH = "publish_items";
+
+ /**
+ * Allows the user to view the live version of {@link ContentItems}.
+ */
+ public static final String VIEW_PUBLISHED = "view_published_items";
private ItemPrivileges() {
//Nothing
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderController.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderController.java
index 7622ced61..c1ac71974 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderController.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderController.java
@@ -5,7 +5,6 @@
*/
package org.librecms.ui.contentsections;
-
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.api.Identifier;
@@ -145,144 +144,92 @@ public class DocumentFolderController {
@QueryParam("maxResults") @DefaultValue("20") final int maxResults
) {
final long start = System.currentTimeMillis();
- final Identifier identifier = identifierParser.parseIdentifier(
+ final Optional sectionResult = retrieveContentSection(
sectionIdentifier
);
- final Optional sectionResult;
- switch (identifier.getType()) {
- case ID:
- sectionResult = sectionRepo.findById(
- Long.parseLong(identifier.getIdentifier())
- );
- break;
- case UUID:
- sectionResult = sectionRepo.findByUuid(identifier
- .getIdentifier());
- break;
- default:
- sectionResult = sectionRepo.findByLabel(identifier
- .getIdentifier());
- break;
- }
- LOGGER.info("Retrieved content section in {} ms", System
- .currentTimeMillis() - start);
+ LOGGER.info("Retrieved content section in {} ms",
+ System.currentTimeMillis() - start
+ );
- if (sectionResult.isPresent()) {
- final ContentSection section = sectionResult.get();
-
- final long permissionCheckStart = System.currentTimeMillis();
- if (permissionChecker.isPermitted(
- ItemPrivileges.EDIT, section.getRootDocumentsFolder()
- )) {
- contentSectionModel.setSection(section);
- LOGGER.info(
- "Checked in permisisons in {} ms.",
- System.currentTimeMillis() - permissionCheckStart
- );
-
- final Folder folder;
- if (folderPath.isBlank()) {
- folder = section.getRootDocumentsFolder();
- documentFolderModel.setBreadcrumbs(Collections.emptyList());
- } else {
- final Optional folderResult = folderRepo
- .findByPath(section,
- folderPath,
- FolderType.DOCUMENTS_FOLDER
- );
- if (folderResult.isPresent()) {
- folder = folderResult.get();
- if (!permissionChecker.isPermitted(
- ItemPrivileges.EDIT, folder
- )) {
- models.put("sectionidentifier", sectionIdentifier);
- models.put("folderPath", folderPath);
- return "org/librecms/ui/contentsection/access-denied.xhtml";
- }
- final List breadcrumbs
- = new ArrayList<>();
- final List tokens = Arrays
- .stream(folderPath.split("/"))
- .filter(token -> !token.isEmpty())
- .collect(Collectors.toList());
- for (final String token : tokens) {
- final String path = breadcrumbs
- .stream()
- .map(DocumentFolderBreadcrumbModel::getPathToken)
- .collect(Collectors.joining("/"));
- final DocumentFolderBreadcrumbModel breadcrumb
- = new DocumentFolderBreadcrumbModel();
- breadcrumb.setPath(path);
- breadcrumb.setPathToken(token);
- breadcrumbs.add(breadcrumb);
- }
- breadcrumbs
- .get(breadcrumbs.size() - 1)
- .setCurrentFolder(true);
- documentFolderModel.setBreadcrumbs(breadcrumbs);
- } else {
- models.put("contentSection", section.getLabel());
- models.put("folderPath", folderPath);
- return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
- }
- }
-
- final long objectsStart = System.currentTimeMillis();
- final List folderEntries = folderRepo
- .getDocumentFolderEntries(
- folder,
- firstResult,
- maxResults,
- filterTerm
- );
- LOGGER.info(
- "Retrieved objects in {} ms",
- System.currentTimeMillis() - objectsStart
- );
- documentFolderModel.setCount(
- folderRepo.countDocumentFolderEntries(folder, filterTerm)
- );
- documentFolderModel.setFirstResult(firstResult);
- documentFolderModel.setMaxResults(maxResults);
- LOGGER.info(
- "Retrieved and counted objects in {} ms",
- System.currentTimeMillis() - objectsStart
- );
-
- final List folderTree = buildFolderTree(
- section, folder
- );
- contentSectionModel.setFolders(folderTree);
-
- final long rowsStart = System.currentTimeMillis();
- documentFolderModel.setRows(
- folderEntries
- .stream()
- .map(entry -> buildRowModel(section, entry))
- .collect(Collectors.toList())
- );
- LOGGER.info(
- "Build rows in {} ms.",
- System.currentTimeMillis() - rowsStart
- );
-
- documentFolderModel.setPath(folderPath);
- documentFolderModel.setCanCreateSubFolders(
- permissionChecker.isPermitted(
- ItemPrivileges.CREATE_NEW, folder
- )
- );
-
- return "org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml";
- } else {
- models.put("sectionidentifier", sectionIdentifier);
- return "org/librecms/ui/contentsection/access-denied.xhtml";
- }
- } else {
+ if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
}
+ final ContentSection section = sectionResult.get();
+ if (!permissionChecker.isPermitted(
+ ItemPrivileges.EDIT, section.getRootDocumentsFolder()
+ )) {
+ models.put("sectionidentifier", sectionIdentifier);
+ return "org/librecms/ui/contentsection/access-denied.xhtml";
+ }
+
+ final Folder folder;
+ if (folderPath.isEmpty()) {
+ folder = section.getRootDocumentsFolder();
+ documentFolderModel.setBreadcrumbs(Collections.emptyList());
+ } else {
+ final Optional folderResult = folderRepo
+ .findByPath(
+ section,
+ folderPath,
+ FolderType.DOCUMENTS_FOLDER
+ );
+ if (folderResult.isPresent()) {
+ folder = folderResult.get();
+
+ documentFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath));
+ } else {
+ models.put("contentSection", section.getLabel());
+ models.put("folderPath", folderPath);
+ return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
+ }
+ }
+
+ if (!permissionChecker.isPermitted(ItemPrivileges.EDIT, folder)) {
+ models.put("sectionidentifier", sectionIdentifier);
+ models.put("folderPath", folderPath);
+ return "org/librecms/ui/contentsection/access-denied.xhtml";
+ }
+
+ final List folderEntries = folderRepo
+ .getDocumentFolderEntries(
+ folder,
+ firstResult,
+ maxResults,
+ filterTerm
+ );
+ documentFolderModel.setCount(
+ folderRepo.countDocumentFolderEntries(folder, filterTerm)
+ );
+ documentFolderModel.setFirstResult(firstResult);
+ documentFolderModel.setMaxResults(maxResults);
+
+ final List folderTree = buildFolderTree(
+ section, folder
+ );
+ contentSectionModel.setFolders(folderTree);
+
+ documentFolderModel.setRows(
+ folderEntries
+ .stream()
+ .map(entry -> buildRowModel(section, entry))
+ .collect(Collectors.toList())
+ );
+
+ documentFolderModel.setPath(folderPath);
+ documentFolderModel.setCanCreateSubFolders(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CREATE_NEW, folder
+ )
+ );
+ documentFolderModel.setCanCreateItems(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CREATE_NEW, folder
+ )
+ );
+
+ return "org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml";
}
@GET
@@ -399,10 +346,64 @@ public class DocumentFolderController {
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("parentFolderPath") final String parentFolderPath,
@FormParam("folderName") final String folderName
+ ) {
+ final Optional sectionResult = retrieveContentSection(
+ sectionIdentifier
+ );
+
+ if (!sectionResult.isPresent()) {
+ models.put("sectionIdentifier", sectionIdentifier);
+ return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
+ }
+
+ final ContentSection section = sectionResult.get();
+ if (!permissionChecker.isPermitted(
+ ItemPrivileges.EDIT, section.getRootDocumentsFolder()
+ )) {
+ models.put("sectionidentifier", sectionIdentifier);
+ return "org/librecms/ui/contentsection/access-denied.xhtml";
+ }
+
+ final Folder parentFolder;
+ if (parentFolderPath.isEmpty()) {
+ parentFolder = section.getRootDocumentsFolder();
+ } else {
+ final Optional parentFolderResult = folderRepo
+ .findByPath(section, parentFolderPath,
+ FolderType.DOCUMENTS_FOLDER);
+ if (parentFolderResult.isPresent()) {
+ parentFolder = parentFolderResult.get();
+ } else {
+ models.put("contentSection", section.getLabel());
+ models.put("folderPath", parentFolderPath);
+ return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
+ }
+ }
+
+ if (!permissionChecker.isPermitted(
+ ItemPrivileges.CREATE_NEW, parentFolder
+ )) {
+ models.put("sectionidentifier", sectionIdentifier);
+ models.put("folderPath", parentFolderPath);
+ return "org/librecms/ui/contentsection/access-denied.xhtml";
+ }
+
+ folderManager.createFolder(folderName, parentFolder);
+
+ return String.format(
+ "redirect:/%s/documentfolders/%s",
+ sectionIdentifier,
+ parentFolderPath
+ );
+ }
+
+ private Optional retrieveContentSection(
+ final String sectionIdentifier
) {
final Identifier identifier = identifierParser.parseIdentifier(
sectionIdentifier
);
+
final Optional sectionResult;
switch (identifier.getType()) {
case ID:
@@ -419,57 +420,8 @@ public class DocumentFolderController {
.getIdentifier());
break;
}
-
- if (sectionResult.isPresent()) {
- final ContentSection section = sectionResult.get();
-
- if (!permissionChecker.isPermitted(
- ItemPrivileges.EDIT, section.getRootDocumentsFolder()
- )) {
- models.put("sectionidentifier", sectionIdentifier);
- models.put("folderPath", parentFolderPath);
- return "org/librecms/ui/contentsection/access-denied.xhtml";
- }
-
- final Folder parentFolder;
- if (parentFolderPath.isEmpty()) {
- parentFolder = section.getRootDocumentsFolder();
- } else {
- final Optional parentFolderResult = folderRepo
- .findByPath(section, parentFolderPath,
- FolderType.DOCUMENTS_FOLDER);
- if (parentFolderResult.isPresent()) {
- parentFolder = parentFolderResult.get();
- } else {
- models.put("contentSection", section.getLabel());
- models.put("folderPath", parentFolderPath);
- return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
- }
- }
-
- if (permissionChecker.isPermitted(
- ItemPrivileges.CREATE_NEW, parentFolder
- )) {
- folderManager.createFolder(folderName, parentFolder);
-
- return String.format(
- "redirect:/%s/documentfolders/%s",
- sectionIdentifier,
- parentFolderPath
- );
- } else {
- models.put("sectionidentifier", sectionIdentifier);
- models.put("folderPath", parentFolderPath);
- return "org/librecms/ui/contentsection/access-denied.xhtml";
- }
-
- } else {
- models.put("sectionIdentifier", sectionIdentifier);
- return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
- }
+ return sectionResult;
}
-
-
private List buildFolderTree(
final ContentSection section, final Folder currentFolder
@@ -515,6 +467,7 @@ public class DocumentFolderController {
node.setPath(folderPath);
node.setOpen(currentFolderPath.startsWith(folderPath));
node.setSelected(currentFolderPath.equals(folderPath));
+ node.setPermissions(buildItemPermissionsModel(folder));
node.setSubFolders(
folder
.getSubFolders()
@@ -534,6 +487,32 @@ public class DocumentFolderController {
return node;
}
+ private List buildBreadcrumbs(
+ final String folderPath
+ ) {
+ final List breadcrumbs
+ = new ArrayList<>();
+ final List tokens = Arrays
+ .stream(folderPath.split("/"))
+ .filter(token -> !token.isEmpty())
+ .collect(Collectors.toList());
+ for (final String token : tokens) {
+ final String path = breadcrumbs
+ .stream()
+ .map(DocumentFolderBreadcrumbModel::getPathToken)
+ .collect(Collectors.joining("/"));
+ final DocumentFolderBreadcrumbModel breadcrumb
+ = new DocumentFolderBreadcrumbModel();
+ breadcrumb.setPath(path);
+ breadcrumb.setPathToken(token);
+ breadcrumbs.add(breadcrumb);
+ }
+ breadcrumbs
+ .get(breadcrumbs.size() - 1)
+ .setCurrentFolder(true);
+ return breadcrumbs;
+ }
+
private DocumentFolderRowModel buildRowModel(
final ContentSection section, final DocumentFolderEntry entry
) {
@@ -575,6 +554,7 @@ public class DocumentFolderController {
"org.librecms.CmsAdminMessages"
).getText("contentsection.documentfolder.types.folder")
);
+ row.setPermissions(buildItemPermissionsModel(folder));
} else {
final ContentItem contentItem = itemRepo
.findById(entry.getEntryId())
@@ -635,8 +615,9 @@ public class DocumentFolderController {
);
row.setType(
contentTypeRepo
- .findByContentSectionAndClass(section, contentItem
- .getClass())
+ .findByContentSectionAndClass(
+ section, contentItem.getClass()
+ )
.map(ContentType::getLabel)
.map(
label -> globalizationHelper
@@ -645,10 +626,125 @@ public class DocumentFolderController {
)
).orElse("?")
);
+ row.setPermissions(buildItemPermissionsModel(contentItem));
}
return row;
}
+ private ItemPermissionsModel buildItemPermissionsModel(
+ final Folder folder
+ ) {
+ final ItemPermissionsModel model = new ItemPermissionsModel();
+ model.setGrantedAdminister(
+ permissionChecker.isPermitted(
+ ItemPrivileges.ADMINISTER, folder
+ )
+ );
+ model.setGrantedApplyAlternateWorkflow(
+ permissionChecker.isPermitted(
+ ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, folder
+ )
+ );
+ model.setGrantedApprove(
+ permissionChecker.isPermitted(
+ ItemPrivileges.APPROVE, folder
+ )
+ );
+ model.setGrantedCategorize(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CATEGORIZE, folder
+ )
+ );
+ model.setGrantedCreateNew(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CREATE_NEW, folder
+ )
+ );
+ model.setGrantedDelete(
+ permissionChecker.isPermitted(
+ ItemPrivileges.DELETE, folder
+ )
+ );
+ model.setGrantedEdit(
+ permissionChecker.isPermitted(
+ ItemPrivileges.EDIT, folder
+ )
+ );
+ model.setGrantedPreview(
+ permissionChecker.isPermitted(
+ ItemPrivileges.PREVIEW, folder
+ )
+ );
+ model.setGrantedPublish(
+ permissionChecker.isPermitted(
+ ItemPrivileges.PUBLISH, folder
+ )
+ );
+ model.setGrantedViewPublished(
+ permissionChecker.isPermitted(
+ ItemPrivileges.VIEW_PUBLISHED, folder
+ )
+ );
+ return model;
+ }
+
+ private ItemPermissionsModel buildItemPermissionsModel(
+ final ContentItem item
+ ) {
+final ItemPermissionsModel model = new ItemPermissionsModel();
+ model.setGrantedAdminister(
+ permissionChecker.isPermitted(
+ ItemPrivileges.ADMINISTER, item
+ )
+ );
+ model.setGrantedApplyAlternateWorkflow(
+ permissionChecker.isPermitted(
+ ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, item
+ )
+ );
+ model.setGrantedApprove(
+ permissionChecker.isPermitted(
+ ItemPrivileges.APPROVE, item
+ )
+ );
+ model.setGrantedCategorize(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CATEGORIZE, item
+ )
+ );
+ model.setGrantedCreateNew(
+ permissionChecker.isPermitted(
+ ItemPrivileges.CREATE_NEW, item
+ )
+ );
+ model.setGrantedDelete(
+ permissionChecker.isPermitted(
+ ItemPrivileges.DELETE, item
+ )
+ );
+ model.setGrantedEdit(
+ permissionChecker.isPermitted(
+ ItemPrivileges.EDIT, item
+ )
+ );
+ model.setGrantedPreview(
+ permissionChecker.isPermitted(
+ ItemPrivileges.PREVIEW, item
+ )
+ );
+ model.setGrantedPublish(
+ permissionChecker.isPermitted(
+ ItemPrivileges.PUBLISH, item
+ )
+ );
+ model.setGrantedViewPublished(
+ permissionChecker.isPermitted(
+ ItemPrivileges.VIEW_PUBLISHED, item
+ )
+ );
+ return model;
+ }
+
}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderModel.java
index c44cedfa6..84c2117de 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderModel.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderModel.java
@@ -34,7 +34,8 @@ public class DocumentFolderModel {
private String path;
private boolean canCreateSubFolders;
-
+
+ private boolean canCreateItems;
public long getCount() {
return count;
@@ -102,4 +103,12 @@ public class DocumentFolderModel {
this.canCreateSubFolders = canCreateSubFolders;
}
+
+ public boolean isCanCreateItems() {
+ return canCreateItems;
+ }
+
+ protected void setCanCreateItems(final boolean canCreateItems) {
+ this.canCreateItems = canCreateItems;
+ }
}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderRowModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderRowModel.java
index 839b15501..9d7bb1adc 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderRowModel.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/DocumentFolderRowModel.java
@@ -35,6 +35,8 @@ public class DocumentFolderRowModel {
private String title;
private String type;
+
+ private ItemPermissionsModel permissions;
public String getCreated() {
return created;
@@ -128,4 +130,14 @@ public class DocumentFolderRowModel {
this.type = type;
}
+ public ItemPermissionsModel getPermissions() {
+ return permissions;
+ }
+
+ protected void setPermissions(
+ final ItemPermissionsModel permissions
+ ) {
+ this.permissions = permissions;
+ }
+
}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/FolderTreeNode.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/FolderTreeNode.java
index 1e5d8d6ee..8eb67b0d3 100644
--- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/FolderTreeNode.java
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/FolderTreeNode.java
@@ -5,6 +5,7 @@
*/
package org.librecms.ui.contentsections;
+import java.util.Collections;
import java.util.List;
/**
@@ -12,21 +13,23 @@ import java.util.List;
* @author Jens Pelzetter
*/
public class FolderTreeNode {
-
+
private long folderId;
-
+
private String uuid;
-
+
private String name;
-
+
private String path;
-
+
private List subFolders;
-
+
private boolean open;
-
+
private boolean selected;
+ private ItemPermissionsModel permissions;
+
public long getFolderId() {
return folderId;
}
@@ -60,7 +63,7 @@ public class FolderTreeNode {
}
public List getSubFolders() {
- return subFolders;
+ return Collections.unmodifiableList(subFolders);
}
public void setSubFolders(final List subFolders) {
@@ -82,7 +85,15 @@ public class FolderTreeNode {
public void setSelected(final boolean selected) {
this.selected = selected;
}
-
-
-
+
+ public ItemPermissionsModel getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(
+ final ItemPermissionsModel permissions
+ ) {
+ this.permissions = permissions;
+ }
+
}
diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ItemPermissionsModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ItemPermissionsModel.java
new file mode 100644
index 000000000..90b6a673c
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ItemPermissionsModel.java
@@ -0,0 +1,115 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.librecms.ui.contentsections;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class ItemPermissionsModel {
+
+ private boolean grantedAdminister;
+
+ private boolean grantedApplyAlternateWorkflow;
+
+ private boolean grantedApprove;
+
+ private boolean grantedCategorize;
+
+ private boolean grantedCreateNew;
+
+ private boolean grantedDelete;
+
+ private boolean grantedEdit;
+
+ private boolean grantedPreview;
+
+ private boolean grantedPublish;
+
+ private boolean grantedViewPublished;
+
+ public boolean isGrantedAdminister() {
+ return grantedAdminister;
+ }
+
+ public void setGrantedAdminister(final boolean grantedAdminister) {
+ this.grantedAdminister = grantedAdminister;
+ }
+
+ public boolean isGrantedApplyAlternateWorkflow() {
+ return grantedApplyAlternateWorkflow;
+ }
+
+ public void setGrantedApplyAlternateWorkflow(
+ boolean grantedApplyAlternateWorkflow) {
+ this.grantedApplyAlternateWorkflow = grantedApplyAlternateWorkflow;
+ }
+
+ public boolean isGrantedApprove() {
+ return grantedApprove;
+ }
+
+ public void setGrantedApprove(final boolean grantedApprove) {
+ this.grantedApprove = grantedApprove;
+ }
+
+ public boolean isGrantedCategorize() {
+ return grantedCategorize;
+ }
+
+ public void setGrantedCategorize(final boolean grantedCategorize) {
+ this.grantedCategorize = grantedCategorize;
+ }
+
+ public boolean isGrantedCreateNew() {
+ return grantedCreateNew;
+ }
+
+ public void setGrantedCreateNew(final boolean grantedCreateNew) {
+ this.grantedCreateNew = grantedCreateNew;
+ }
+
+ public boolean isGrantedDelete() {
+ return grantedDelete;
+ }
+
+ public void setGrantedDelete(final boolean grantedDelete) {
+ this.grantedDelete = grantedDelete;
+ }
+
+ public boolean isGrantedEdit() {
+ return grantedEdit;
+ }
+
+ public void setGrantedEdit(final boolean grantedEdit) {
+ this.grantedEdit = grantedEdit;
+ }
+
+ public boolean isGrantedPreview() {
+ return grantedPreview;
+ }
+
+ public void setGrantedPreview(final boolean grantedPreview) {
+ this.grantedPreview = grantedPreview;
+ }
+
+ public boolean isGrantedPublish() {
+ return grantedPublish;
+ }
+
+ public void setGrantedPublish(final boolean grantedPublish) {
+ this.grantedPublish = grantedPublish;
+ }
+
+ public boolean isGrantedViewPublished() {
+ return grantedViewPublished;
+ }
+
+ public void setGrantedViewPublished(final boolean grantedViewPublished) {
+ this.grantedViewPublished = grantedViewPublished;
+ }
+
+}
diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml
index 230f0eac2..39e3fc4ea 100644
--- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml
+++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml
@@ -19,8 +19,16 @@
#{CmsAdminMessages['contentsection.documentfolder.foldersnav.subfolders.expand']}
- #{folder.name}
+
+
+ #{folder.name}
+
+
+ #{folder.name}
+
+
+
diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml
index b8de4e3a0..8052097a6 100644
--- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml
+++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml
@@ -114,70 +114,94 @@
${CmsAdminMessages.getMessage("contentsection.documentfolder.pageof", [DocumentFolderModel.currentPage, DocumentFolderModel.numberOfPages])}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -201,22 +225,25 @@
|
#{CmsAdminMessages['contentsection.documentfolder.headers.lastedit.label']}
|
-
+ |
#{CmsAdminMessages['contentsection.documentfolder.headers.actions.label']}
|
+ var="row">
|
-
+
#{row.name}
-
+
#{row.name}
+
+
+ #{row.name}
|
@@ -247,11 +274,31 @@
+
+
+
+
+
+ |
+
+
+
+
+ |
-
|
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages.properties b/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages.properties
index ba57726cd..a58c3b905 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages.properties
@@ -62,3 +62,5 @@ contentsection.documentfolder.new_subfolder.name.help=The new name of the subfol
contentsection.documentfolder.new_subfolder_dialog.submit=Create new subfolder
contentsection.documentfolder.new_subfolder_dialog.close=Cancel
contentsection.documentfolders.root.title=Documents
+contentsection.documentfolder.actions.rename_folder.button.label=Rename folder
+contentsection.documentfolder.actions.edit_permissions.button.label=Edit permissions
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages_de.properties b/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages_de.properties
index 454420e45..ec8add106 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages_de.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsAdminMessages_de.properties
@@ -62,3 +62,5 @@ contentsection.documentfolder.new_subfolder.name.help=Der Name des neuen Ordners
contentsection.documentfolder.new_subfolder_dialog.submit=Neuen Ordner anlegen
contentsection.documentfolder.new_subfolder_dialog.close=Abbrechen
contentsection.documentfolders.root.title=Dokumente
+contentsection.documentfolder.actions.rename_folder.button.label=Ordner umbebennen
+contentsection.documentfolder.actions.edit_permissions.button.label=Berechtigungen bearbeiten