mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1162: CLONE - Alfresco 4.2.1 could not start with RM module
* see MNT-10259 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1@60429 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -962,7 +962,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
String uuid = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_NODE_UUID));
|
||||
StoreRef storeRef = new StoreRef(protocol, identifier);
|
||||
NodeRef nodeRef = new NodeRef(storeRef, uuid);
|
||||
if ((nodeRef == null) || (permissionService.hasPermission(filePlanService.getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
||||
if ((nodeRef == null) ||
|
||||
(permissionService.hasPermission(getFilePlanService().getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
||||
{
|
||||
filtered.remove(RecordsManagementModel.PROP_HOLD_REASON);
|
||||
}
|
||||
|
@@ -40,10 +40,7 @@ import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* Records managment entry voter.
|
||||
@@ -51,7 +48,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||
* @author Roy Wetherall, Andy Hind
|
||||
*/
|
||||
public class RMEntryVoter extends RMSecurityCommon
|
||||
implements AccessDecisionVoter, InitializingBean, ApplicationContextAware, PolicyRegister
|
||||
implements AccessDecisionVoter, InitializingBean, PolicyRegister
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(RMEntryVoter.class);
|
||||
@@ -70,19 +67,7 @@ public class RMEntryVoter extends RMSecurityCommon
|
||||
|
||||
/** Policy map */
|
||||
private HashMap<String, Policy> policies = new HashMap<String, Policy>();
|
||||
|
||||
/** Application context */
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
*/
|
||||
|
@@ -20,8 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.capability;
|
||||
|
||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
@@ -37,6 +35,9 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.0
|
||||
*/
|
||||
public class RMSecurityCommon
|
||||
public class RMSecurityCommon implements ApplicationContextAware
|
||||
{
|
||||
/** No set value */
|
||||
protected int NOSET_VALUE = -100;
|
||||
@@ -58,9 +59,20 @@ public class RMSecurityCommon
|
||||
/** Services */
|
||||
protected NodeService nodeService; //This is the internal NodeService -- no permission checks
|
||||
protected PermissionService permissionService;
|
||||
protected RecordsManagementService rmService;
|
||||
protected RMCaveatConfigComponent caveatConfigComponent;
|
||||
protected FilePlanService filePlanService;
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/** Application context */
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
@@ -78,14 +90,6 @@ public class RMSecurityCommon
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rmService records management service
|
||||
*/
|
||||
public void setRecordsManagementService(RecordsManagementService rmService)
|
||||
{
|
||||
this.rmService = rmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caveatConfigComponent caveat config service
|
||||
*/
|
||||
@@ -95,12 +99,16 @@ public class RMSecurityCommon
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
* @return FilePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
protected FilePlanService getFilePlanService()
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
if (filePlanService == null)
|
||||
{
|
||||
filePlanService = (FilePlanService)applicationContext.getBean("filePlanService");
|
||||
}
|
||||
return filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value into the transaction cache
|
||||
@@ -205,17 +213,7 @@ public class RMSecurityCommon
|
||||
}
|
||||
|
||||
// Get the file plan for the node
|
||||
NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
|
||||
|
||||
// Admin role
|
||||
//if (permissionService.hasPermission(filePlan, RMPermissionModel.ROLE_ADMINISTRATOR) == AccessStatus.ALLOWED)
|
||||
//{
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("\t\tAdmin user, access granted. (nodeRef=" + nodeRef.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")");
|
||||
// }
|
||||
// return setTransactionCache("checkRmRead", nodeRef, AccessDecisionVoter.ACCESS_GRANTED);
|
||||
// }
|
||||
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
|
||||
|
||||
if (permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS) == AccessStatus.DENIED)
|
||||
{
|
||||
@@ -252,16 +250,11 @@ public class RMSecurityCommon
|
||||
NodeRef testNodeRef = null;
|
||||
if (position < 0)
|
||||
{
|
||||
testNodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||
if (testNodeRef == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Unable to find default file plan node.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\tPermission test against the file plan node " + nodeService.getPath(testNodeRef));
|
||||
logger.debug("\tNothing to test permission against.");
|
||||
}
|
||||
testNodeRef = null;
|
||||
}
|
||||
else if (StoreRef.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
|
@@ -92,8 +92,8 @@ public class CompositeCapability extends DeclarativeCapability
|
||||
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
|
||||
|
||||
// Check we are dealing with a file plan component
|
||||
if (filePlanService.isFilePlanComponent(source) == true &&
|
||||
filePlanService.isFilePlanComponent(target) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(source) == true &&
|
||||
getFilePlanService().isFilePlanComponent(target) == true)
|
||||
{
|
||||
// Check the kind of the object, the permissions and the conditions
|
||||
if (checkKinds(source) == true && checkPermissions(source) == true && checkConditions(source) == true)
|
||||
|
@@ -33,24 +33,17 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* Declarative capability implementation.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class DeclarativeCapability extends AbstractCapability
|
||||
implements ApplicationContextAware
|
||||
public class DeclarativeCapability extends AbstractCapability
|
||||
{
|
||||
/** Logger */
|
||||
protected static Log logger = LogFactory.getLog(DeclarativeCapability.class);
|
||||
|
||||
/** Application Context */
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
/** Required permissions */
|
||||
protected List<String> permissions;
|
||||
|
||||
@@ -66,12 +59,6 @@ public class DeclarativeCapability extends AbstractCapability
|
||||
/** Indicates whether to return an undetermined result */
|
||||
protected boolean isUndetermined = false;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permissions permissions
|
||||
*/
|
||||
@@ -170,7 +157,7 @@ public class DeclarativeCapability extends AbstractCapability
|
||||
protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions)
|
||||
{
|
||||
boolean result = true;
|
||||
NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
|
||||
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
|
||||
|
||||
for (String permission : permissions)
|
||||
{
|
||||
@@ -261,7 +248,7 @@ public class DeclarativeCapability extends AbstractCapability
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(nodeRef);
|
||||
FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef);
|
||||
|
||||
if (actualKind != null)
|
||||
{
|
||||
@@ -298,7 +285,7 @@ public class DeclarativeCapability extends AbstractCapability
|
||||
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
|
||||
|
||||
// Check we are dealing with a file plan component
|
||||
if (filePlanService.isFilePlanComponent(nodeRef) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(nodeRef) == true)
|
||||
{
|
||||
// Check the kind of the object, the permissions and the conditions
|
||||
if (checkKinds(nodeRef) == true && checkPermissions(nodeRef) == true && checkConditions(nodeRef) == true)
|
||||
|
@@ -45,11 +45,11 @@ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
|
||||
*/
|
||||
public int evaluate(NodeRef source, NodeRef target)
|
||||
{
|
||||
if (filePlanService.isFilePlanComponent(source))
|
||||
if (getFilePlanService().isFilePlanComponent(source))
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
if (filePlanService.isFilePlanComponent(target) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(target) == true)
|
||||
{
|
||||
if (checkConditions(source) == true && checkConditions(target) == true)
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@ import java.util.Map;
|
||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
@@ -40,11 +41,21 @@ public class CreateCapability extends DeclarativeCapability
|
||||
{
|
||||
private RecordService recordService;
|
||||
|
||||
protected RecordsManagementService rmService;
|
||||
|
||||
public void setRecordService(RecordService recordService)
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rmService records management service
|
||||
*/
|
||||
public void setRecordsManagementService(RecordsManagementService rmService)
|
||||
{
|
||||
this.rmService = rmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -72,7 +83,7 @@ public class CreateCapability extends DeclarativeCapability
|
||||
return AccessDecisionVoter.ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
if (filePlanService.isFilePlanComponent(destination))
|
||||
if (getFilePlanService().isFilePlanComponent(destination))
|
||||
{
|
||||
if ((assocType == null) || assocType.equals(ContentModel.ASSOC_CONTAINS) == false)
|
||||
{
|
||||
@@ -122,7 +133,7 @@ public class CreateCapability extends DeclarativeCapability
|
||||
{
|
||||
if (rmService.isRecordFolder(destination))
|
||||
{
|
||||
if (permissionService.hasPermission(filePlanService.getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
|
||||
if (permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
@@ -135,7 +146,7 @@ public class CreateCapability extends DeclarativeCapability
|
||||
{
|
||||
if (rmService.isRecordFolder(destination))
|
||||
{
|
||||
if (permissionService.hasPermission(filePlanService.getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED)
|
||||
if (permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
|
@@ -45,8 +45,8 @@ public class DeleteLinksCapability extends DeclarativeCapability
|
||||
*/
|
||||
public int evaluate(NodeRef source, NodeRef target)
|
||||
{
|
||||
if (filePlanService.isFilePlanComponent(source) == true &&
|
||||
filePlanService.isFilePlanComponent(target) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(source) == true &&
|
||||
getFilePlanService().isFilePlanComponent(target) == true)
|
||||
{
|
||||
if (checkConditions(source) == true && checkConditions(target) == true)
|
||||
{
|
||||
|
@@ -35,7 +35,7 @@ public final class ViewRecordsCapability extends DeclarativeCapability
|
||||
{
|
||||
if (nodeRef != null)
|
||||
{
|
||||
if (filePlanService.isFilePlanComponent(nodeRef) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(nodeRef) == true)
|
||||
{
|
||||
return checkRmRead(nodeRef);
|
||||
}
|
||||
|
@@ -39,8 +39,8 @@ public class CapabilityPolicy extends AbstractBasePolicy
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef assignee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS).evaluate(assignee);
|
||||
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS).evaluate(testNodeRef);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user