projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clarify implementation base APIs.
[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..41a6a880d438297a0a3260d0d26a0da045240dd8 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,13
+13,15
@@
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;
+import org.argeo.cms.SystemRole;
import org.argeo.cms.internal.auth.CmsSessionImpl;
import org.argeo.cms.internal.auth.ImpliedByPrincipal;
import org.argeo.cms.internal.runtime.CmsContextImpl;
import org.argeo.cms.internal.auth.CmsSessionImpl;
import org.argeo.cms.internal.auth.ImpliedByPrincipal;
import org.argeo.cms.internal.runtime.CmsContextImpl;
-import org.argeo.util.CurrentSubject;
+import org.argeo.
cms.
util.CurrentSubject;
import org.osgi.service.useradmin.Authorization;
/**
import org.osgi.service.useradmin.Authorization;
/**
@@
-74,6
+76,11
@@
public final class CurrentUser {
return role.implied(currentSubject(), context);
}
return role.implied(currentSubject(), context);
}
+ /** Implies this role name, also independently of the 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);