diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml index 6f589e52b4..5a404cc4b5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml @@ -26,6 +26,17 @@ + + + + + + + + + + + org.alfresco.repo.security.permissions.impl.ExtendedPermissionService diff --git a/rm-server/source/java/org/alfresco/repo/quickshare/ExtendedQuickShareServiceImpl.java b/rm-server/source/java/org/alfresco/repo/quickshare/ExtendedQuickShareServiceImpl.java new file mode 100644 index 0000000000..9eeb6bd6fe --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/quickshare/ExtendedQuickShareServiceImpl.java @@ -0,0 +1,43 @@ +package org.alfresco.repo.quickshare; + +import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevelManager; +import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel; +import org.alfresco.service.cmr.quickshare.QuickShareDTO; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * Extend the QuickShareService to check that content isn't classified before sharing it. + * + * @author David Webster + */ +public class ExtendedQuickShareServiceImpl extends QuickShareServiceImpl +{ + private NodeService nodeService; + + /** + * Set node service locally as inherited instance is private. + * + * @param nodeService the nodeService used to check node props and aspects + */ + @Override + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + super.setNodeService(nodeService); + } + + @Override + public QuickShareDTO shareContent(final NodeRef nodeRef) + { + if (!nodeService.hasAspect(nodeRef, ClassifiedContentModel.ASPECT_CLASSIFIED) || nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION) + .equals(ClassificationLevelManager.UNCLASSIFIED_ID)) + { + return super.shareContent(nodeRef); + } + else + { + throw new IllegalStateException("Unable to share classified content"); + } + } +} \ No newline at end of file