- /**
- * The node authenticated component (typically a CMS view) related to this
- * display, or null if none is available from this call.
- */
- public static NodeAuthenticated getNodeAuthenticated() {
- return UiContext.getData(NodeAuthenticated.KEY);
+ /** Returns true if the current user is in the specified role */
+ public static boolean isInRole(String role) {
+ Set<String> roles = roles();
+ return roles.contains(role);
+ }
+
+ /** Implies this {@link SystemRole} in this context. */
+ public final static boolean implies(SystemRole role, String 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);