diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties index e2d43aa52b..8095c5c74e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties @@ -51,7 +51,7 @@ create-record.title=Declare as Record create-record.description=Declares file as a record and optionally files it create-record.file-plan.display-label=File Plan create-record.hide-record.display-label=Hide Record -create-record.path.display-label=Destination Record Folder Path +create-record.path.display-label=Record Folder Location # Declare As Version Record declare-as-version-record.title=Declare Version as Record declare-as-version-record.description=Declares this version of the file as a record diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml index 6be1b778bb..290e36f303 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml @@ -15,6 +15,7 @@ + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java index 04ca0201a0..d24f146691 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java @@ -36,17 +36,19 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; import org.alfresco.repo.cache.SimpleCache; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.JavaBehaviour; @@ -63,6 +65,7 @@ import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.util.PathUtil; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.ArrayUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -82,6 +85,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS private static final String IS_RM_SITE_CREATED = "isRmSiteCreated"; private static final String IS_RECORD_CONTRIBUTOR_GROUP_ENABLED = "isRecordContributorGroupEnabled"; private static final String RECORD_CONTRIBUTOR_GROUP_NAME = "recordContributorGroupName"; + private static final String IS_VISIBLE_FOR_CURRENT_USER = "isVisibleForCurrentUser"; /** true if record contributor group is enabled, false otherwise */ private boolean isRecordContributorsGroupEnabled = false; @@ -95,6 +99,9 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS /** File plan service */ private FilePlanService filePlanService; + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + /** Capability service */ private CapabilityService capabilityService; @@ -156,6 +163,14 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS this.filePlanService = filePlanService; } + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + /** * @param capabilityService capability service */ @@ -277,7 +292,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS // Set the base root values super.setRootValues(nodeInfo, rootJSONObject, useShortQNames); - // check the exisitance of the RM site + // check the existence of the RM site checkRmSiteExistence(rootJSONObject); // get the record contributor information @@ -301,11 +316,22 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS addInfo(nodeInfo, rootJSONObject); } } + Set filePlans = filePlanService.getFilePlans(); + if (!CollectionUtils.isEmpty(filePlans)) + { + NodeRef filePlanNodeRef = filePlans.stream().findFirst().orElse(null); + if (filePlanNodeRef != null) + { + Set roles = filePlanRoleService.getRolesByUser(filePlanNodeRef, AuthenticationUtil.getFullyAuthenticatedUser()); + boolean hasFilingPermission = !CollectionUtils.isEmpty(roles); + rootJSONObject.put(IS_VISIBLE_FOR_CURRENT_USER, hasFilingPermission); + } + } } } /** - * Checks for the existance of the RM site + * Checks for the existence of the RM site * * @param rootJSONObject the root JSON object */