mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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@96974 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,9 @@ public class TransferCompleteAction extends RMActionExecuterAbstractBase
|
||||
/** I18N */
|
||||
private static final String MSG_NODE_NOT_TRANSFER = "rm.action.node-not-transfer";
|
||||
|
||||
/** Action name */
|
||||
public static final String NAME = "transferComplete";
|
||||
|
||||
/** Transfer service */
|
||||
private TransferService transferService;
|
||||
|
||||
|
@@ -22,9 +22,13 @@ 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.
|
||||
@@ -33,6 +37,9 @@ import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -55,8 +62,18 @@ public class TransferEvaluator extends BaseEvaluator
|
||||
NodeRef transfer = getTransferNodeRef(nodeRef);
|
||||
if (transfer != null)
|
||||
{
|
||||
boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue();
|
||||
result = (actual == transferAccessionIndicator);
|
||||
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;
|
||||
|
@@ -308,13 +308,31 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
public void onCreateTransfer(final ChildAssociationRef childAssocRef)
|
||||
{
|
||||
mandatory("childAssocRef", childAssocRef);
|
||||
NodeRef childRef = childAssocRef.getChildRef();
|
||||
|
||||
final 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);
|
||||
|
||||
final String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
|
||||
final boolean hasUserPermission = authenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>()
|
||||
{
|
||||
public Boolean doWork()
|
||||
{
|
||||
return getPermissionService().hasPermission(childRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED;
|
||||
}
|
||||
}, user);
|
||||
|
||||
if (!hasUserPermission)
|
||||
{
|
||||
authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork()
|
||||
{
|
||||
getPermissionService().setPermission(childRef, user, RMPermissionModel.FILING, true);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -545,7 +563,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
|
||||
private boolean canPerformPermissionAction(NodeRef nodeRef)
|
||||
{
|
||||
return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef);
|
||||
return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef) || isTransfer(nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user