RM-1800 (Transfers are not displayed for non-rm-admin users)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@93971 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-01-23 17:33:33 +00:00
parent 68032013d4
commit f038e1189c
3 changed files with 59 additions and 21 deletions

View File

@@ -446,6 +446,8 @@
<property name="policyComponent" ref="policyComponent"/>
<property name="ownableService" ref="ownableService" />
<property name="authorityService" ref="AuthorityService" />
<property name="filePlanRoleService" ref="FilePlanRoleService" />
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="FilePlanPermissionService" class="org.springframework.aop.framework.ProxyFactoryBean">

View File

@@ -22,13 +22,9 @@ import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Evaluates whether the node in question is transferring is either a transfer or accession.
@@ -37,9 +33,6 @@ import org.apache.commons.logging.LogFactory;
*/
public class TransferEvaluator extends BaseEvaluator
{
/** Logger */
private static Log logger = LogFactory.getLog(TransferEvaluator.class);
/** indicates whether we are looking for accessions or transfers */
private boolean transferAccessionIndicator = false;
@@ -61,20 +54,10 @@ public class TransferEvaluator extends BaseEvaluator
NodeRef transfer = getTransferNodeRef(nodeRef);
if (transfer != null)
{
try
{
boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue();
result = (actual == transferAccessionIndicator);
}
catch (AccessDeniedException ade)
{
logger.info("The user '"
+ AuthenticationUtil.getFullyAuthenticatedUser()
+ "' does not have permissions on the node '"
+ transfer + "'.");
}
}
return result;
}

View File

@@ -32,6 +32,7 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
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.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.repo.node.NodeServicePolicies;
@@ -76,6 +77,12 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
/** Authority service */
private AuthorityService authorityService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/** File plan service */
private FilePlanService filePlanService;
/** Logger */
private static final Log LOGGER = LogFactory.getLog(FilePlanPermissionServiceImpl.class);
@@ -168,6 +175,46 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
this.authorityService = authorityService;
}
/**
* Gets the file plan role service
*
* @return The file plan role service
*/
public FilePlanRoleService getFilePlanRoleService()
{
return this.filePlanRoleService;
}
/**
* Sets the file plan role service
*
* @param filePlanRoleService The file plan role service to set
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* Gets the file plan service
*
* @return The file plan service
*/
public FilePlanService getFilePlanService()
{
return this.filePlanService;
}
/**
* Sets the file plan service
*
* @param filePlanService The file plan service to set
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -256,7 +303,13 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
public void onCreateTransfer(final ChildAssociationRef childAssocRef)
{
mandatory("childAssocRef", childAssocRef);
setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef());
NodeRef childRef = childAssocRef.getChildRef();
setupPermissions(childAssocRef.getParentRef(), childRef);
// Give read permissions for all RM roles for the transfer folders (see RM-1800).
// This behaviour will be changed once the add manage permission option is added in the UI for the transfers containers.
NodeRef filePlan = getFilePlanService().getFilePlan(childRef);
String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan);
getPermissionService().setPermission(childRef, allRoles, READ_RECORDS, true);
}
/**