コード例 #1
0
ファイル: Statistics.java プロジェクト: Melzar/cyklotron
 public boolean checkAccessRights(Context context) throws ProcessingException {
   CoralSession coralSession = (CoralSession) context.getAttribute(CoralSession.class);
   try {
     SiteResource site = getSite();
     Role role = null;
     if (site != null) {
       CmsData cmsData = cmsDataFactory.getCmsData(context);
       if (!cmsData.isApplicationEnabled("statistics")) {
         logger.debug("Application 'statistics' not enabled in site");
         return false;
       }
       role = site.getAdministrator();
     } else {
       role = coralSession.getSecurity().getUniqueRole("cms.administrator");
     }
     return coralSession.getUserSubject().hasRole(role);
   } catch (ProcessingException e) {
     logger.error("Subject has no rights to view this screen", e);
     return false;
   }
 }