mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature/RM-6864_AddedEvaluatorForDeclareAndFileAction' into 'master'
Resolve RM-6864 Fix permission issue for File as record action Closes RM-6864 See merge request records-management/records-management!1190
This commit is contained in:
@@ -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
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<property name="recordContributorsGroupName" value="${rm.record.contributors.group.name}"/>
|
||||
<property name="recordService" ref="RecordService"/>
|
||||
<property name="filePlanService" ref="FilePlanService"/>
|
||||
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
||||
<property name="capabilityService" ref="CapabilityService"/>
|
||||
<property name="dictionaryService" ref="DictionaryService" />
|
||||
<property name="siteService" ref="SiteService" />
|
||||
|
@@ -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<NodeRef> filePlans = filePlanService.getFilePlans();
|
||||
if (!CollectionUtils.isEmpty(filePlans))
|
||||
{
|
||||
NodeRef filePlanNodeRef = filePlans.stream().findFirst().orElse(null);
|
||||
if (filePlanNodeRef != null)
|
||||
{
|
||||
Set<Role> 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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user