Merged DEV to HEAD:

92360: RM-1649 : (Access denied to Declare Record to Unfiled Records for user with Create Records capability)
        - I handled the case when the destination folder is not a record folder and the user doesn't need File Record capability to create a record there
        - unit test fixed and working as part of the merge



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@92523 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-12-18 04:45:02 +00:00
parent 9c50bd65f5
commit aeb3747a25
3 changed files with 83 additions and 14 deletions

View File

@@ -120,7 +120,14 @@ public class CreateCapability extends DeclarativeCapability
conditions.put("capabilityCondition.frozen", Boolean.FALSE);
conditions.put("capabilityCondition.closed", Boolean.FALSE);
conditions.put("capabilityCondition.cutoff", Boolean.FALSE);
// if the destination folder is not a record folder and the user has filling capability on it, grant access to create the record
if (checkConditions(destination, conditions) &&
!recordFolderService.isRecordFolder(destination) )
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
if (checkConditions(destination, conditions) &&
recordFolderService.isRecordFolder(destination) &&
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)

View File

@@ -221,6 +221,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
/** Relationship service */
private RelationshipService relationshipService;
/** records management container type */
private RecordsManagementContainerType recordsManagementContainerType;
/** list of available record meta-data aspects and the file plan types the are applicable to */
@@ -1061,7 +1062,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
ParameterCheck.mandatory("nodeRef", parent);
ParameterCheck.mandatory("name", name);
NodeRef record = null;
NodeRef result = null;
NodeRef destination = parent;
if (isFilePlan(parent))
@@ -1088,7 +1089,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
try
{
// create the new record
record = fileFolderService.create(destination, name, type).getNodeRef();
final NodeRef record = fileFolderService.create(destination, name, type).getNodeRef();
// set the properties
if (properties != null)
@@ -1104,23 +1105,32 @@ public class RecordServiceImpl extends BaseBehaviourBean
writer.setMimetype(reader.getMimetype());
writer.putContent(reader);
}
result = authenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
// Check if the "record" aspect has been applied already.
// In case of filing a report the created node will be made
// a record within the "onCreateChildAssociation" method if
// a destination for the report has been selected.
if (!nodeService.hasAspect(record, ASPECT_RECORD))
{
// make record
makeRecord(record);
}
return record;
}
});
}
finally
{
enablePropertyEditableCheck();
}
// Check if the "record" aspect has been applied already.
// In case of filing a report the created node will be made
// a record within the "onCreateChildAssociation" method if
// a destination for the report has been selected.
if (!nodeService.hasAspect(record, ASPECT_RECORD))
{
// make record
makeRecord(record);
}
return record;
return result;
}
/**