mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
MNT-16852: Optimise list conversion as per code review comment
This commit is contained in:
@@ -134,10 +134,10 @@
|
|||||||
<ref bean="extendedReaderDynamicAuthority" />
|
<ref bean="extendedReaderDynamicAuthority" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="readMapping">
|
<property name="configuredReadPermissions">
|
||||||
<value>{rm.haspermissionmap.read}</value>
|
<value>{rm.haspermissionmap.read}</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="fileMapping">
|
<property name="configuredFilePermissions">
|
||||||
<value>{rm.haspermissionmap.write}</value>
|
<value>{rm.haspermissionmap.write}</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -52,9 +52,15 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
/** Writers simple cache */
|
/** Writers simple cache */
|
||||||
protected SimpleCache<Serializable, Set<String>> writersCache;
|
protected SimpleCache<Serializable, Set<String>> writersCache;
|
||||||
|
|
||||||
/** Permission maps*/
|
/**
|
||||||
protected String readMapping;
|
* Configured Permission mapping.
|
||||||
protected String fileMapping;
|
*
|
||||||
|
* These strings come from alfresco-global.properties and allow fine tuning of the how permissions are mapped.
|
||||||
|
* This was added as a fix for MNT-16852 to enhance compatibility with our Outlook Integration.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
protected List<String> configuredReadPermissions;
|
||||||
|
protected List<String> configuredFilePermissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean)
|
* @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean)
|
||||||
@@ -75,19 +81,25 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Maps the string from the properties file (rm.haspermissionmap.read)
|
||||||
|
* to the list used in the hasPermission method
|
||||||
|
*
|
||||||
* @param readMapping the mapping of permissions to ReadRecord
|
* @param readMapping the mapping of permissions to ReadRecord
|
||||||
*/
|
*/
|
||||||
public void setReadMapping(String readMapping)
|
public void setConfiguredReadPermissions(String readMapping)
|
||||||
{
|
{
|
||||||
this.readMapping = readMapping;
|
this.configuredReadPermissions = Arrays.asList(readMapping.split(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param fileMapping the mapping of permissions to ReadRecord
|
* Maps the string set in the properties file (rm.haspermissionmap.write)
|
||||||
|
* to the list used in the hasPermission method
|
||||||
|
*
|
||||||
|
* @param fileMapping the mapping of permissions to FileRecord
|
||||||
*/
|
*/
|
||||||
public void setFileMapping(String fileMapping)
|
public void setConfiguredFilePermissions(String fileMapping)
|
||||||
{
|
{
|
||||||
this.fileMapping = fileMapping;
|
this.configuredFilePermissions = Arrays.asList(fileMapping.split(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,16 +127,11 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
if (AccessStatus.DENIED.equals(acs) &&
|
if (AccessStatus.DENIED.equals(acs) &&
|
||||||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
|
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
|
||||||
{
|
{
|
||||||
// These strings come from alfresco-global.properties and allow fine tuning of the how permissions are mapped.
|
if (PermissionService.READ.equals(perm) || this.configuredReadPermissions.contains(perm))
|
||||||
// This was added as a fix for MNT-16852 to enhance compatibility for our Outlook Integration.
|
|
||||||
List<String> configuredReadPermissions = Arrays.asList(this.readMapping.split(","));
|
|
||||||
List<String> configuredFilePermissions = Arrays.asList(this.fileMapping.split(","));
|
|
||||||
|
|
||||||
if (PermissionService.READ.equals(perm) || configuredReadPermissions.contains(perm))
|
|
||||||
{
|
{
|
||||||
return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS);
|
return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS);
|
||||||
}
|
}
|
||||||
else if (PermissionService.WRITE.equals(perm) || configuredFilePermissions.contains(perm))
|
else if (PermissionService.WRITE.equals(perm) || this.configuredFilePermissions.contains(perm))
|
||||||
{
|
{
|
||||||
return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS);
|
return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user