mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1904 (SubCategory moved to root have inheritance on)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@96580 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -63,7 +63,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
@BehaviourBean
|
||||
public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
implements FilePlanPermissionService,
|
||||
RMPermissionModel
|
||||
RMPermissionModel,
|
||||
NodeServicePolicies.OnMoveNodePolicy
|
||||
{
|
||||
/** Permission service */
|
||||
private PermissionService permissionService;
|
||||
@@ -99,6 +100,10 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
NodeServicePolicies.OnMoveNodePolicy.QNAME,
|
||||
ASPECT_RECORD,
|
||||
new JavaBehaviour(this, "onMoveRecord", TRANSACTION_COMMIT));
|
||||
getPolicyComponent().bindClassBehaviour(
|
||||
NodeServicePolicies.OnMoveNodePolicy.QNAME,
|
||||
TYPE_RECORD_CATEGORY,
|
||||
new JavaBehaviour(this, "onMoveNode", TRANSACTION_COMMIT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,4 +547,16 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
|
||||
*/
|
||||
@Override
|
||||
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
|
||||
{
|
||||
if (isFilePlan(newChildAssocRef.getParentRef()))
|
||||
{
|
||||
permissionService.setInheritParentPermissions(oldChildAssocRef.getChildRef(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1240,4 +1240,25 @@ public class FilePlanPermissionServiceImplTest extends BaseRMTestCase
|
||||
assertTrue(accessPermissions.containsKey(adminRole));
|
||||
assertEquals(RMPermissionModel.FILING, accessPermissions.get(adminRole));
|
||||
}
|
||||
|
||||
public void testMoveSubCategoryIntoFilePlan()
|
||||
{
|
||||
final NodeRef rootCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||
final NodeRef subCategory = filePlanService.createRecordCategory(rootCategory, GUID.generate());
|
||||
|
||||
assertFalse(permissionService.getInheritParentPermissions(rootCategory));
|
||||
assertTrue(permissionService.getInheritParentPermissions(subCategory));
|
||||
|
||||
final NodeRef movedSubCategory = doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
return fileFolderService.move(subCategory, filePlan, null).getNodeRef();
|
||||
}
|
||||
});
|
||||
|
||||
assertFalse(permissionService.getInheritParentPermissions(rootCategory));
|
||||
assertFalse(permissionService.getInheritParentPermissions(movedSubCategory));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user