RM-1506 (Deleting In-Place Reader or Writer roles breaks Record declaration)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@70987 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-05-19 13:23:12 +00:00
parent ae9a33f4a7
commit e014b16b01
2 changed files with 8 additions and 1 deletions

View File

@@ -784,6 +784,12 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
throw new AlfrescoRuntimeException("Can not delete the records management administration role."); throw new AlfrescoRuntimeException("Can not delete the records management administration role.");
} }
// ensure that we are not trying to delete a system role
if (FilePlanRoleService.SYSTEM_ROLES.contains(role))
{
throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted.");
}
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{ {
public Boolean doWork() throws Exception public Boolean doWork() throws Exception

View File

@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptException;
@@ -45,7 +46,7 @@ public class RmRoleDelete extends RoleDeclarativeWebScript
// Role name // Role name
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars(); Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String roleParam = templateVars.get("rolename"); String roleParam = templateVars.get("rolename");
if (roleParam == null) if (StringUtils.isBlank(roleParam))
{ {
throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL.");
} }