コード例 #1
0
 @Override
 public void process(TemplatingContext templatingContext) throws ProcessingException {
   RequestParameters parameters = RequestParameters.getRequestParameters(context);
   super.process(templatingContext);
   if (parameters.get("exportType").equals("full") || parameters.get("exportType").equals("xml")) {
     templatingContext.put("recordDetails", recordDetailsExport);
     templatingContext.put("dateConverter", new PatternDateConverter("yyyyMMdd"));
   }
   if (parameters.get("exportType").equals("xml")) {
     HttpContext httpContext = HttpContext.getHttpContext(context);
     httpContext.setContentType("application/xml");
   }
 }
コード例 #2
0
ファイル: AddAlias.java プロジェクト: objectledge/cyklotron
 public boolean checkAccessRights(Context context) throws ProcessingException {
   CoralSession coralSession = (CoralSession) context.getAttribute(CoralSession.class);
   RequestParameters parameters = RequestParameters.getRequestParameters(context);
   try {
     NavigationNodeResource node = getCmsData(context).getNode();
     NavigationNodeResource originalNode =
         NavigationNodeResourceImpl.getNavigationNodeResource(
             coralSession, parameters.getLong("original_node_id"));
     Permission addInboundAlias =
         coralSession.getSecurity().getUniquePermission("cms.structure.add_inbound_alias");
     return node.canAddChild(coralSession, coralSession.getUserSubject())
         && coralSession.getUserSubject().hasPermission(originalNode, addInboundAlias);
   } catch (EntityDoesNotExistException e) {
     throw new ProcessingException("missing or invalid parameters", e);
   }
 }
コード例 #3
0
 public boolean checkAccessRights(Context context) throws ProcessingException {
   Parameters parameters = RequestParameters.getRequestParameters(context);
   CoralSession coralSession = (CoralSession) context.getAttribute(CoralSession.class);
   try {
     long dirId = parameters.getLong("parent_id", -1);
     if (dirId == -1) {
       return true;
     } else {
       Resource resource = coralSession.getStore().getResource(dirId);
       Permission permission = coralSession.getSecurity().getUniquePermission("cms.files.write");
       return coralSession.getUserSubject().hasPermission(resource, permission);
     }
   } catch (Exception e) {
     logger.error("Subject has no rights to view this screen", e);
     return false;
   }
 }
コード例 #4
0
 public void prepareDefault(Context context) throws ProcessingException {
   Parameters parameters = RequestParameters.getRequestParameters(context);
   CoralSession coralSession = (CoralSession) context.getAttribute(CoralSession.class);
   HttpContext httpContext = HttpContext.getHttpContext(context);
   I18nContext i18nContext = I18nContext.getI18nContext(context);
   TemplatingContext templatingContext = TemplatingContext.getTemplatingContext(context);
   SiteResource site = getSite();
   try {
     templatingContext.put("styles", Arrays.asList(styleService.getStyles(coralSession, site)));
     long parent_node_id = parameters.getLong("parent_node_id", -1);
     if (parent_node_id == -1) {
       templatingContext.put("parent_node", getHomePage());
     } else {
       templatingContext.put(
           "parent_node",
           NavigationNodeResourceImpl.getNavigationNodeResource(coralSession, parent_node_id));
     }
   } catch (Exception e) {
     throw new ProcessingException("Screen Error " + e);
   }
 }
コード例 #5
0
 /** Checks if the current user has the specific permission on the current category. */
 public boolean checkPermission(Context context, CoralSession coralSession, String permissionName)
     throws ProcessingException {
   Parameters parameters = RequestParameters.getRequestParameters(context);
   return CategoryUtil.checkPermission(coralSession, parameters, permissionName);
 }
コード例 #6
0
 public String getState() {
   Parameters parameters = RequestParameters.getRequestParameters(context);
   return parameters.get("state", "Default");
 }