mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'master' into feature/RM-4613_Select_Single_Instruction
This commit is contained in:
@@ -13,7 +13,7 @@ log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info
|
|||||||
# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be
|
# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be
|
||||||
# removed to enhance performance.
|
# removed to enhance performance.
|
||||||
#
|
#
|
||||||
log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=debug
|
log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=info
|
||||||
|
|
||||||
#
|
#
|
||||||
# RM permission debug
|
# RM permission debug
|
||||||
|
@@ -39,10 +39,10 @@ rm.action.parameter-not-supplied=Add a ''{0}'' to continue.
|
|||||||
rm.action.delete-not-hold-type=We couldn't delete the hold because {1} isn't of type {0}.
|
rm.action.delete-not-hold-type=We couldn't delete the hold because {1} isn't of type {0}.
|
||||||
rm.action.cast-to-rm-type=You can't upload a custom folder type to the records management file plan.
|
rm.action.cast-to-rm-type=You can't upload a custom folder type to the records management file plan.
|
||||||
rm.action.record-folder-create=You can't create a record folder in another record folder.
|
rm.action.record-folder-create=You can't create a record folder in another record folder.
|
||||||
rm.action.unique.child.type-error-message=Operation failed. Multiple children of this type are not allowed.
|
rm.action.unique.child.type-error-message=You can't create multiple items of this type here.
|
||||||
rm.action.multiple.children.type-error-message=Operation failed. Children of type {0} are not allowed
|
rm.action.multiple.children.type-error-message=You can't create {0} here.
|
||||||
rm.action.create.transfer.container.child-error-message=Operation failed. Creation is not allowed in Transfer Container.
|
rm.action.create.transfer.container.child-error-message=You can't create items in the Transfer container.
|
||||||
rm.action.create.transfer.child-error-message=Operation failed. Creation is not allowed in Transfer Folders.
|
rm.action.create.transfer.child-error-message=You can't create items in Transfer Folders.
|
||||||
rm.action.create.record.folder.child-error-message=Only records can be created in record folders but it was {0}
|
rm.action.create.record.folder.child-error-message=You can only create records in record folders and this was a {0}.
|
||||||
rm.action.transfer-non-editable=The metadata of transfer nodes is not editable.
|
rm.action.transfer-non-editable=You can't edit transfer folder or container metadata.
|
||||||
|
|
||||||
|
@@ -20,5 +20,5 @@ rm.service.node-has-aspect=The record type {1} is already showing for record {0}
|
|||||||
rm.service.final-version=Final
|
rm.service.final-version=Final
|
||||||
rm.service.final-version-description=The final archived record version
|
rm.service.final-version-description=The final archived record version
|
||||||
rm.service.enable-autoversion-on-record-creation=Auto Version on Record Creation
|
rm.service.enable-autoversion-on-record-creation=Auto Version on Record Creation
|
||||||
rm.service.add-children-to-closed-record-folder=You can't add new items to a closed record folder
|
rm.service.add-children-to-closed-record-folder=You can't add new items to a closed record folder.
|
||||||
rm.service.update-record-content=Could not update content property as it's immutable for records.
|
rm.service.update-record-content=You can't update a record's content property.
|
@@ -35,9 +35,10 @@
|
|||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="namespaceService" ref="NamespaceService"/>
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
<property name="capabilityService" ref="CapabilityService"/>
|
<property name="capabilityService" ref="CapabilityService"/>
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="filePlanService" />
|
||||||
<property name="dispositionService" ref="DispositionService" />
|
<property name="dispositionService" ref="DispositionService" />
|
||||||
<property name="recordFolderService" ref="RecordFolderService" />
|
<property name="recordFolderService" ref="RecordFolderService" />
|
||||||
|
<property name="transactionalResourceHelper" ref="rm.transactionalResourceHelper" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="jsonConversionComponent.baseIndicator"
|
<bean id="jsonConversionComponent.baseIndicator"
|
||||||
|
@@ -149,8 +149,11 @@ public class RMSecurityCommon implements ApplicationContextAware
|
|||||||
protected int getTransactionCache(String prefix, NodeRef nodeRef)
|
protected int getTransactionCache(String prefix, NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
int result = NOSET_VALUE;
|
int result = NOSET_VALUE;
|
||||||
String user = AuthenticationUtil.getRunAsUser();
|
StringBuffer key = new StringBuffer(prefix)
|
||||||
Integer value = (Integer)AlfrescoTransactionSupport.getResource(prefix + nodeRef.toString() + user);
|
.append(nodeRef)
|
||||||
|
.append(AuthenticationUtil.getRunAsUser());
|
||||||
|
|
||||||
|
Integer value = (Integer)AlfrescoTransactionSupport.getResource(key);
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
result = value.intValue();
|
result = value.intValue();
|
||||||
|
@@ -29,9 +29,12 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
@@ -44,8 +47,6 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declarative capability implementation.
|
* Declarative capability implementation.
|
||||||
*
|
*
|
||||||
@@ -70,6 +71,9 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
|
|
||||||
/** Indicates whether to return an undetermined result */
|
/** Indicates whether to return an undetermined result */
|
||||||
protected boolean isUndetermined = false;
|
protected boolean isUndetermined = false;
|
||||||
|
|
||||||
|
/** List of available kinds */
|
||||||
|
private Set<FilePlanComponentKind> availableKinds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param permissions permissions
|
* @param permissions permissions
|
||||||
@@ -258,6 +262,27 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
{
|
{
|
||||||
return checkConditions(nodeRef, conditions);
|
return checkConditions(nodeRef, conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of available kinds
|
||||||
|
*
|
||||||
|
* @return list of available kinds
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Set<FilePlanComponentKind> getAvailableKinds()
|
||||||
|
{
|
||||||
|
if (kinds != null && availableKinds == null)
|
||||||
|
{
|
||||||
|
availableKinds = new HashSet<FilePlanComponentKind>(kinds.size());
|
||||||
|
for (String kindString : kinds)
|
||||||
|
{
|
||||||
|
FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString);
|
||||||
|
availableKinds.add(kind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableKinds;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the node ref is of the expected kind
|
* Checks that the node ref is of the expected kind
|
||||||
@@ -273,23 +298,9 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
|
|
||||||
if (actualKind != null)
|
if (actualKind != null)
|
||||||
{
|
{
|
||||||
if (kinds != null && !kinds.isEmpty())
|
Set<FilePlanComponentKind> availableKinds = getAvailableKinds();
|
||||||
|
if (availableKinds == null || availableKinds.contains(actualKind))
|
||||||
{
|
{
|
||||||
// need to check the actual file plan kind is in the list specified
|
|
||||||
for (String kindString : kinds)
|
|
||||||
{
|
|
||||||
FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString);
|
|
||||||
if (actualKind.equals(kind))
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we don't have any specific kinds to check, so we pass since we have a file
|
|
||||||
// plan component in our hands
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,20 +40,26 @@ 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.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base evaluator.
|
* Base evaluator.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public abstract class BaseEvaluator implements RecordsManagementModel
|
public abstract class BaseEvaluator implements RecordsManagementModel, BeanNameAware
|
||||||
{
|
{
|
||||||
/** Name */
|
/** Name */
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
/** bean name */
|
||||||
|
protected String beanName;
|
||||||
|
|
||||||
/** JSON conversion component */
|
/** JSON conversion component */
|
||||||
protected JSONConversionComponent jsonConversionComponent;
|
protected JSONConversionComponent jsonConversionComponent;
|
||||||
@@ -84,7 +90,19 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
|
|
||||||
/** Record folder service */
|
/** Record folder service */
|
||||||
protected RecordFolderService recordFolderService;
|
protected RecordFolderService recordFolderService;
|
||||||
|
|
||||||
|
/** transactional resource helper */
|
||||||
|
protected TransactionalResourceHelper transactionalResourceHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param beanName bean name
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setBeanName(String beanName)
|
||||||
|
{
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param jsonConversionComponent json conversion component
|
* @param jsonConversionComponent json conversion component
|
||||||
*/
|
*/
|
||||||
@@ -148,6 +166,14 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
{
|
{
|
||||||
this.recordFolderService = recordFolderService;
|
this.recordFolderService = recordFolderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param transactionalResourceHelper transactional resource helper
|
||||||
|
*/
|
||||||
|
public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper)
|
||||||
|
{
|
||||||
|
this.transactionalResourceHelper = transactionalResourceHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
@@ -217,17 +243,25 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
*/
|
*/
|
||||||
public boolean evaluate(NodeRef nodeRef)
|
public boolean evaluate(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
Map<String, Boolean> results = transactionalResourceHelper.getMap("BaseEvaluator.evaluate");
|
||||||
|
String key = new StringBuffer(nodeRef.toString()).append(AuthenticationUtil.getRunAsUser()).append(beanName).toString();
|
||||||
// Check that we are dealing with the correct kind of RM object
|
|
||||||
if ((kinds == null || checkKinds(nodeRef)) &&
|
if (!results.containsKey(key))
|
||||||
// Check we have the required capabilities
|
|
||||||
(capabilities == null || checkCapabilities(nodeRef)))
|
|
||||||
{
|
{
|
||||||
result = evaluateImpl(nodeRef);
|
boolean result = false;
|
||||||
|
|
||||||
|
// Check that we are dealing with the correct kind of RM object
|
||||||
|
if ((kinds == null || checkKinds(nodeRef)) &&
|
||||||
|
// Check we have the required capabilities
|
||||||
|
(capabilities == null || checkCapabilities(nodeRef)))
|
||||||
|
{
|
||||||
|
result = evaluateImpl(nodeRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
results.put(key, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return results.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String utility methods.
|
||||||
|
*
|
||||||
|
* @author Tom Page
|
||||||
|
* @since 2.6
|
||||||
|
*/
|
||||||
|
public class StringUtils
|
||||||
|
{
|
||||||
|
/** Private constructor for the helper class. */
|
||||||
|
private StringUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces (except the first line).
|
||||||
|
*/
|
||||||
|
public static String toIndentedString(Object o)
|
||||||
|
{
|
||||||
|
if (o == null)
|
||||||
|
{
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user