mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'master' of https://git.alfresco.com/records-management/records-management into feature/RM-7066_UpdateToACS62
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
<property name="nodeService" ref="nodeService" />
|
<property name="nodeService" ref="nodeService" />
|
||||||
<property name="filePlanService" ref="filePlanService" />
|
<property name="filePlanService" ref="filePlanService" />
|
||||||
<property name="filePlanRoleService" ref="filePlanRoleService" />
|
<property name="filePlanRoleService" ref="filePlanRoleService" />
|
||||||
|
<property name="dictionaryService" ref="DictionaryService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.NamePathDataExtractor">
|
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.NamePathDataExtractor">
|
||||||
|
@@ -31,19 +31,21 @@ import java.io.Serializable;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
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.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
||||||
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
|
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extractor that uses a node context to determine the currently-authenticated
|
* An extractor that uses a node context to determine the currently-authenticated
|
||||||
* user's RM roles. This is not a data generator because it can only function in
|
* user's RM roles. This is not a data generator because it can only function in
|
||||||
* the context of a give node.
|
* the context of a given node.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
@@ -53,6 +55,7 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
|
|||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
private FilePlanRoleService filePlanRoleService;
|
private FilePlanRoleService filePlanRoleService;
|
||||||
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to check that the node in the context is a fileplan component
|
* Used to check that the node in the context is a fileplan component
|
||||||
@@ -79,8 +82,16 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents
|
* @param dictionaryService dictionary service
|
||||||
* a fileplan component
|
*/
|
||||||
|
public void setDictionaryService(DictionaryService dictionaryService)
|
||||||
|
{
|
||||||
|
this.dictionaryService = dictionaryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents either a fileplan component or
|
||||||
|
* a subtype of content
|
||||||
*/
|
*/
|
||||||
public boolean isSupported(Serializable data)
|
public boolean isSupported(Serializable data)
|
||||||
{
|
{
|
||||||
@@ -88,7 +99,9 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
|
NodeRef nodeRef = (NodeRef) data;
|
||||||
|
return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) ||
|
||||||
|
dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,6 +122,14 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
|
|||||||
// Get the rm root
|
// Get the rm root
|
||||||
NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef);
|
NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef);
|
||||||
|
|
||||||
|
// if we don't have an rm root and the given node is a subtype of content
|
||||||
|
if (rmRootNodeRef == null &&
|
||||||
|
dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT))
|
||||||
|
{
|
||||||
|
// use the default file plan
|
||||||
|
rmRootNodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
if (rmRootNodeRef != null)
|
if (rmRootNodeRef != null)
|
||||||
{
|
{
|
||||||
Set<Role> roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user);
|
Set<Role> roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user);
|
||||||
|
Reference in New Issue
Block a user