- private static Subject currentSubject() {
- CmsView cmsView = CmsUtils.getCmsView();
- if (cmsView != null)
- return cmsView.getSubject();
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject != null)
- return subject;
- throw new RuntimeException("Cannot find related subject");
- }
+ @Deprecated
+ public static String getCurrentUsername() {
+ return CurrentUser.getUsername();
+ }
+
+ // /**
+ // * Fork of the {@link CurrentUser#currentSubject} method that is private.
+ // * TODO Enhance and factorize
+ // */
+ // private static Subject currentSubject() {
+ // CmsView cmsView = CmsUtils.getCmsView();
+ // if (cmsView != null)
+ // return cmsView.getSubject();
+ // Subject subject = Subject.getSubject(AccessController.getContext());
+ // if (subject != null)
+ // return subject;
+ // throw new RuntimeException("Cannot find related subject");
+ // }