From: Mathieu Baudier Date: Tue, 25 Oct 2016 17:14:19 +0000 (+0000) Subject: Allow regular user to be data admin X-Git-Tag: argeo-commons-2.1.50~6 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=c1ca96ac2b2520858a5cd2639ef62f6edcf764f7;p=lgpl%2Fargeo-commons.git Allow regular user to be data admin git-svn-id: https://svn.argeo.org/commons/trunk@9287 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/org.argeo.ext.jackrabbit/src/org/argeo/security/jackrabbit/ArgeoSecurityManager.java b/org.argeo.ext.jackrabbit/src/org/argeo/security/jackrabbit/ArgeoSecurityManager.java index fde490d2e..15199c0ce 100644 --- a/org.argeo.ext.jackrabbit/src/org/argeo/security/jackrabbit/ArgeoSecurityManager.java +++ b/org.argeo.ext.jackrabbit/src/org/argeo/security/jackrabbit/ArgeoSecurityManager.java @@ -64,6 +64,18 @@ public class ArgeoSecurityManager extends DefaultSecurityManager { throw new IllegalStateException("Inconsistent " + subject); else return NodeConstants.ROLE_ANONYMOUS; + } else if (isRegularUser) {// must be before DataAdmin + if (isAnonymous || isJackrabbitSystem) + throw new IllegalStateException("Inconsistent " + subject); + else { + if (userPrincipal.size() > 1) { + StringBuilder buf = new StringBuilder(); + for (X500Principal principal : userPrincipal) + buf.append(' ').append('\"').append(principal).append('\"'); + throw new RuntimeException("Multiple user principals:" + buf); + } + return userPrincipal.iterator().next().getName(); + } } else if (isDataAdmin) { if (isAnonymous || isJackrabbitSystem || isRegularUser) throw new IllegalStateException("Inconsistent " + subject); @@ -76,18 +88,6 @@ public class ArgeoSecurityManager extends DefaultSecurityManager { throw new IllegalStateException("Inconsistent " + subject); else return super.getUserID(subject, workspaceName); - } else if (isRegularUser) { - if (isAnonymous || isDataAdmin || isJackrabbitSystem) - throw new IllegalStateException("Inconsistent " + subject); - else { - if (userPrincipal.size() > 1) { - StringBuilder buf = new StringBuilder(); - for (X500Principal principal : userPrincipal) - buf.append(' ').append('\"').append(principal).append('\"'); - throw new RuntimeException("Multiple user principals:" + buf); - } - return userPrincipal.iterator().next().getName(); - } } else { throw new IllegalStateException("Unrecognized subject type: " + subject); }