projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Can check string-based roles
[lgpl/argeo-commons.git]
/
org.argeo.cms
/
src
/
org
/
argeo
/
cms
/
auth
/
CurrentUser.java
diff --git
a/org.argeo.cms/src/org/argeo/cms/auth/CurrentUser.java
b/org.argeo.cms/src/org/argeo/cms/auth/CurrentUser.java
index 68ea5ff28243543112cbd586e5dbdd467b412acb..2fd8730d8aafd8c77fbf2aae0f750025e3f1d5bf 100644
(file)
--- a/
org.argeo.cms/src/org/argeo/cms/auth/CurrentUser.java
+++ b/
org.argeo.cms/src/org/argeo/cms/auth/CurrentUser.java
@@
-13,6
+13,7
@@
import java.util.UUID;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
+import org.argeo.api.acr.NamespaceUtils;
import org.argeo.api.cms.CmsConstants;
import org.argeo.api.cms.CmsSession;
import org.argeo.api.cms.CmsSessionId;
import org.argeo.api.cms.CmsConstants;
import org.argeo.api.cms.CmsSession;
import org.argeo.api.cms.CmsSessionId;
@@
-74,6
+75,11
@@
public final class CurrentUser {
return role.implied(currentSubject(), context);
}
return role.implied(currentSubject(), context);
}
+ /** Implies this {@link SystemRole} in this context. */
+ public final static boolean implies(String role, String context) {
+ return SystemRole.implied(NamespaceUtils.parsePrefixedName(role), currentSubject(), context);
+ }
+
/** Executes as the current user */
public final static <T> T doAs(PrivilegedAction<T> action) {
return Subject.doAs(currentSubject(), action);
/** Executes as the current user */
public final static <T> T doAs(PrivilegedAction<T> action) {
return Subject.doAs(currentSubject(), action);