RM-982: Normal user can File and Reject record they declared.

* FileUnfiledRecords and RejectRecords are now assignable capabilities
  * by default Admin, Records Manager, Security Manager and Power User have them
  * they can be added and removed from custom or default roles via the management UI
  * capability patch updated accordingly
  * extedned get roles ReST API to include/exclude system roles
  * In-Place Reader and In-Place Writer roles capabilities are configurable again, but their users and groups are not (as intended)



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-09-25 07:05:10 +00:00
parent c1f293eabf
commit 402110f843
11 changed files with 87 additions and 20 deletions

View File

@@ -101,7 +101,7 @@
<ref bean="rmMoveRecordCategoryCapability"/> <ref bean="rmMoveRecordCategoryCapability"/>
<ref bean="rmMoveRecordFolderCapability"/> <ref bean="rmMoveRecordFolderCapability"/>
<ref bean="rmMoveRecordsCapability"/> <ref bean="rmMoveRecordsCapability"/>
<ref bean="rmFileToRecordsCapability"/> <ref bean="rmFileUnfiledRecordsCapability"/>
</list> </list>
</property> </property>
</bean> </bean>

View File

@@ -117,10 +117,10 @@
<property name="targetCapability" ref="rmFileRecordsCapability" /> <property name="targetCapability" ref="rmFileRecordsCapability" />
</bean> </bean>
<bean id="rmFileToRecordsCapability" <bean id="rmFileUnfiledRecordsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="FileToRecords"/> <property name="name" value="FileUnfiledRecords"/>
<property name="private" value="true" /> <!-- This is an unasingable capability, we reference an assignable one in the target --> <property name="permission" value="FileUnfiledRecords"/>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <!-- Checks if the user has the filling capability --> <entry key="capabilityCondition.filling" value="true"/> <!-- Checks if the user has the filling capability -->
@@ -128,7 +128,9 @@
<entry key="capabilityCondition.recordFiled" value="false"/> <!-- Checks that the node hasn't been filed --> <entry key="capabilityCondition.recordFiled" value="false"/> <!-- Checks that the node hasn't been filed -->
</map> </map>
</property> </property>
<property name="targetCapability" ref="rmFileRecordsCapability" /> <!-- Checks that the user has the correct capability on the destination folder --> <property name="targetCapability" ref="rmFileRecordsCapability" /> <!-- Checks that the user has the correct capability on the destination folder -->
<property name="group"><ref bean="recordsGroup"/></property>
<property name="index" value="41" />
</bean> </bean>
<bean id="rmDeclareRecordsCapability" <bean id="rmDeclareRecordsCapability"
@@ -254,7 +256,7 @@
<bean id="rmRejectRecordsCapability" <bean id="rmRejectRecordsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="RejectRecords"/> <property name="name" value="RejectRecords"/>
<property name="private" value="true" /> <property name="permission" value="RejectRecords"/>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <entry key="capabilityCondition.filling" value="true"/>
@@ -265,6 +267,8 @@
<entry key="capabilityCondition.recordFiled" value="false"/> <entry key="capabilityCondition.recordFiled" value="false"/>
</map> </map>
</property> </property>
<property name="group"><ref bean="recordsGroup"/></property>
<property name="index" value="42" />
</bean> </bean>
<bean id="rmHideRecordsCapability" <bean id="rmHideRecordsCapability"

View File

@@ -5,6 +5,8 @@ capability.ViewRecords.title=View Records
capability.UndeclareRecords.title=Reopen Records capability.UndeclareRecords.title=Reopen Records
capability.CreateRecords.title=Create Records capability.CreateRecords.title=Create Records
capability.RequestRecordInformation.title=Request Record Information capability.RequestRecordInformation.title=Request Record Information
capability.RejectRecords=Reject Records
capability.FileUnfiledRecords=File Unfiled Records
# Metadata Control # Metadata Control
capability.group.metadataControl.title=Metadata Control capability.group.metadataControl.title=Metadata Control

View File

@@ -84,6 +84,8 @@
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="ManageRules"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="ManageRules"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="RequestRecordInformation"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="RequestRecordInformation"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="FileDestructionReport"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="FileDestructionReport"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="FileUnfiledRecords"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="RejectRecords"/>
</permissionGroup> </permissionGroup>
<permissionGroup name="Filing" allowFullControl="false" expose="true"> <permissionGroup name="Filing" allowFullControl="false" expose="true">
@@ -160,6 +162,8 @@
<permissionGroup name="ManageRules" expose="false" allowFullControl="false"/> <permissionGroup name="ManageRules" expose="false" allowFullControl="false"/>
<permissionGroup name="RequestRecordInformation" expose="false" allowFullControl="false"/> <permissionGroup name="RequestRecordInformation" expose="false" allowFullControl="false"/>
<permissionGroup name="FileDestructionReport" expose="false" allowFullControl="false"/> <permissionGroup name="FileDestructionReport" expose="false" allowFullControl="false"/>
<permissionGroup name="RejectRecords" expose="false" allowFullControl="false"/>
<permissionGroup name="FileUnfiledRecords" expose="false" allowFullControl="false"/>
<!-- End --> <!-- End -->
@@ -421,6 +425,14 @@
<grantedToGroup permissionGroup="FileDestructionReport"/> <grantedToGroup permissionGroup="FileDestructionReport"/>
</permission> </permission>
<permission name="_FileUnfiledRecords" expose="false">
<grantedToGroup permissionGroup="FileUnfiledRecords"/>
</permission>
<permission name="_RejectRecords" expose="false">
<grantedToGroup permissionGroup="RejectRecords"/>
</permission>
</permissionSet> </permissionSet>
</permissions> </permissions>

View File

@@ -807,10 +807,20 @@
<property name="target" ref="reject"/> <property name="target" ref="reject"/>
<property name="interceptorNames"> <property name="interceptorNames">
<list> <list>
<idref bean="allow_security"/> <idref bean="reject_security"/>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="reject_security" class="org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor" parent="actionSecurity">
<property name="objectDefinitionSource">
<value>
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.RejectRecords
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW
org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW
</value>
</property>
</bean>
<bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction"> <bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction">
<property name="publicAction" value="true"/> <property name="publicAction" value="true"/>
@@ -822,10 +832,20 @@
<property name="target" ref="fileTo"/> <property name="target" ref="fileTo"/>
<property name="interceptorNames"> <property name="interceptorNames">
<list> <list>
<idref bean="allow_security"/> <idref bean="fileTo_security"/>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="fileTo_security" class="org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor" parent="actionSecurity">
<property name="objectDefinitionSource">
<value>
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.FileUnfiledRecords
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW
org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW
</value>
</property>
</bean>
<bean id="fileTo" class="org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction" parent="rmAction"> <bean id="fileTo" class="org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction" parent="rmAction">
<property name="fileFolderService" ref="FileFolderService"/> <property name="fileFolderService" ref="FileFolderService"/>

View File

@@ -308,7 +308,7 @@
<value>RECORD</value> <value>RECORD</value>
</set> </set>
</property> </property>
<property name="capability" value="FileToRecords" /> <property name="capability" value="FileUnfiledRecords" />
</bean> </bean>
<bean id="jsonConversionComponent.file" <bean id="jsonConversionComponent.file"

View File

@@ -46,7 +46,9 @@
"ReOpenFolders", "ReOpenFolders",
"CycleVitalRecords", "CycleVitalRecords",
"PlanningReviewCycles", "PlanningReviewCycles",
"RequestRecordInformation" "RequestRecordInformation",
"FileUnfiledRecords",
"RejectRecords"
] ]
}, },
{ {
@@ -67,7 +69,9 @@
"ReOpenFolders", "ReOpenFolders",
"CycleVitalRecords", "CycleVitalRecords",
"PlanningReviewCycles", "PlanningReviewCycles",
"RequestRecordInformation" "RequestRecordInformation",
"FileUnfiledRecords",
"RejectRecords"
] ]
}, },
{ {
@@ -128,7 +132,9 @@
"ExportAudit", "ExportAudit",
"CreateModifyDestroyReferenceTypes", "CreateModifyDestroyReferenceTypes",
"RequestRecordInformation", "RequestRecordInformation",
"FileDestructionReport" "FileDestructionReport",
"FileUnfiledRecords",
"RejectRecords"
] ]
}, },
{ {
@@ -191,7 +197,9 @@
"ManageAccessControls", "ManageAccessControls",
"ManageRules", "ManageRules",
"RequestRecordInformation", "RequestRecordInformation",
"FileDestructionReport" "FileDestructionReport",
"FileUnfiledRecords",
"RejectRecords"
] ]
} }
] ]

View File

@@ -9,11 +9,12 @@
siteid - id of a RM site to take the file plan from siteid - id of a RM site to take the file plan from
user - only returns roles that this user is assigned to user - only returns roles that this user is assigned to
auths - if true, returns details of authorites directly assigned to the role. false by default. auths - if true, returns details of authorites directly assigned to the role. false by default.
is - if true includes system roles in the results, otherwise excludes them. false by default.
]]> ]]>
</description> </description>
<url>/api/rma/admin/rmroles?user={user?}&amp;auths={auths?}</url> <!-- NOTE: this URL should be considered as deprecated --> <url>/api/rma/admin/rmroles?user={user?}&amp;auths={auths?}&amp;is={is?}</url> <!-- NOTE: this URL should be considered as deprecated -->
<url>/api/rma/admin/{store_type}/{store_id}/{id}/rmroles?user={user?}&amp;auths={auths?}</url> <url>/api/rma/admin/{store_type}/{store_id}/{id}/rmroles?user={user?}&amp;auths={auths?}&amp;is={is?}</url>
<url>/api/rma/admin/{siteid}/rmroles?user={user?}&amp;auths={auths?}</url> <url>/api/rma/admin/{siteid}/rmroles?user={user?}&amp;auths={auths?}&amp;is={is?}</url>
<format default="json">argument</format> <format default="json">argument</format>
<authentication>user</authentication> <authentication>user</authentication>
<transaction allow="readonly">required</transaction> <transaction allow="readonly">required</transaction>

View File

@@ -122,7 +122,19 @@ public class RMv21CapabilityPatch extends ModulePatchComponent
addCapability(filePlan, addCapability(filePlan,
"FileDestructionReport", "FileDestructionReport",
FilePlanRoleService.ROLE_ADMIN, FilePlanRoleService.ROLE_ADMIN,
FilePlanRoleService.ROLE_RECORDS_MANAGER); FilePlanRoleService.ROLE_RECORDS_MANAGER);
addCapability(filePlan,
"RejectRecords",
FilePlanRoleService.ROLE_ADMIN,
FilePlanRoleService.ROLE_POWER_USER,
FilePlanRoleService.ROLE_RECORDS_MANAGER,
FilePlanRoleService.ROLE_SECURITY_OFFICER);
addCapability(filePlan,
"FileUnfiledRecords",
FilePlanRoleService.ROLE_ADMIN,
FilePlanRoleService.ROLE_POWER_USER,
FilePlanRoleService.ROLE_RECORDS_MANAGER,
FilePlanRoleService.ROLE_SECURITY_OFFICER);
} }
if (logger.isDebugEnabled() == true) if (logger.isDebugEnabled() == true)

View File

@@ -57,16 +57,24 @@ public class RmRolesGet extends RoleDeclarativeWebScript
{ {
throw new WebScriptException(Status.STATUS_FOUND, "File plan does not exist."); throw new WebScriptException(Status.STATUS_FOUND, "File plan does not exist.");
} }
// get the includesystem parameter
boolean includeSystem = false;
String includeSystemValue = req.getParameter("is");
if (includeSystemValue != null && includeSystemValue.length() != 0)
{
includeSystem = Boolean.parseBoolean(includeSystemValue);
}
// get the user filter // get the user filter
String user = req.getParameter("user"); String user = req.getParameter("user");
if (user != null && user.length() != 0) if (user != null && user.length() != 0)
{ {
roles = filePlanRoleService.getRolesByUser(filePlan, user, false); roles = filePlanRoleService.getRolesByUser(filePlan, user, includeSystem);
} }
else else
{ {
roles = filePlanRoleService.getRoles(filePlan, false); roles = filePlanRoleService.getRoles(filePlan, includeSystem);
} }
// get the auths parameter // get the auths parameter

View File

@@ -83,7 +83,7 @@ public class FileToActionTest extends BaseRMTestCase
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING));
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmFolder, RMPermissionModel.FILING));
Capability capability = capabilityService.getCapability("FileToRecords"); Capability capability = capabilityService.getCapability("FileUnfiledRecords");
assertNotNull(capability); assertNotNull(capability);
assertEquals(AccessStatus.ALLOWED, capability.hasPermission(dmDocument)); assertEquals(AccessStatus.ALLOWED, capability.hasPermission(dmDocument));