+ private static Subject currentSubject() {
+ NodeAuthenticated cmsView = getNodeAuthenticated();
+ if (cmsView != null)
+ return cmsView.getLoginContext().getSubject();
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject != null)
+ return subject;
+ throw new CmsException("Cannot find related subject");
+ }
+
+ /** 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);
+ }
+