mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1573: Holds the user has read-only permission for are displayed in Remove from Hold dialog
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@75188 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -249,8 +249,6 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
||||
// get the root hold container
|
||||
NodeRef holdContainer = filePlanService.getHoldContainer(filePlan);
|
||||
|
||||
// If you remove the "All Records Management Roles" which means users do not have read permissions on hold container
|
||||
// at all, the hold container will not be found for the logged in user. That's why we need to do a check here.
|
||||
if (holdContainer != null)
|
||||
{
|
||||
// get the children of the root hold container
|
||||
@@ -258,8 +256,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
||||
for (ChildAssociationRef holdAssoc : holdsAssocs)
|
||||
{
|
||||
NodeRef hold = holdAssoc.getChildRef();
|
||||
boolean hasPermissionOnHold = (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.ALLOWED);
|
||||
if (isHold(hold) && hasPermissionOnHold)
|
||||
if (isHold(hold))
|
||||
{
|
||||
// add to list of holds
|
||||
holds.add(hold);
|
||||
|
@@ -26,11 +26,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
@@ -54,6 +57,9 @@ public class HoldsGet extends DeclarativeWebScript
|
||||
|
||||
/** Hold Service */
|
||||
private HoldService holdService;
|
||||
|
||||
/** permission service */
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* Set the file plan service
|
||||
@@ -84,6 +90,16 @@ public class HoldsGet extends DeclarativeWebScript
|
||||
{
|
||||
this.holdService = holdService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the permission service
|
||||
*
|
||||
* @param permissionService the permission service
|
||||
*/
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
|
||||
@@ -91,6 +107,7 @@ public class HoldsGet extends DeclarativeWebScript
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
boolean fileOnly = getFileOnly(req);
|
||||
NodeRef itemNodeRef = getItemNodeRef(req);
|
||||
List<NodeRef> holds = new ArrayList<NodeRef>();
|
||||
|
||||
@@ -108,8 +125,12 @@ public class HoldsGet extends DeclarativeWebScript
|
||||
List<Hold> holdObjects = new ArrayList<Hold>(holds.size());
|
||||
for (NodeRef nodeRef : holds)
|
||||
{
|
||||
String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
holdObjects.add(new Hold(name, nodeRef));
|
||||
// only add if user has filling permisson on the hold
|
||||
if (!fileOnly || permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED)
|
||||
{
|
||||
String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
holdObjects.add(new Hold(name, nodeRef));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
@@ -189,6 +210,17 @@ public class HoldsGet extends DeclarativeWebScript
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean getFileOnly(WebScriptRequest req)
|
||||
{
|
||||
boolean result = false;
|
||||
String fillingOnly = req.getParameter("fileOnly");
|
||||
if (StringUtils.isNotBlank(fillingOnly))
|
||||
{
|
||||
result = Boolean.valueOf(fillingOnly).booleanValue();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to sort the holds by their names
|
||||
|
Reference in New Issue
Block a user