public boolean hasPermission(String siteName, String role, Action action) { if (action.getParameter() == null) { return siteService.hasPermission(siteName, role, action); } else { if (action.getActionName().startsWith("/page/")) { return contents.hasPermission(siteName, action.getParameter(), role); } else { throw new UnsupportedOperationException(); } } }
public Action createParameteredAction(String parameter) { return new Action(this.actionName, parameter); }
public void putActionRoles(Action action, String roles) { actionRolesMap.put(action.getActionName(), roles); }
public boolean hasPermission(String siteName, HttpServletRequest request, Action action) { if (action.getParameter() == null) { return siteService.hasPermission(siteName, request, action); } else { return false; } }
public boolean hasPermission(CmsRequest request, String pagename) { SiteConfig siteConfig = siteService .getSiteConfig(request.getSiteName()); // to-use siteService // for PageForm Ajax Action action = Action.PAGE_VIEW.createParameteredAction(pagename); if (!siteConfig.isSecurity() || securityService.hasPermission(request.getSiteName(), action)) { return true; } else { return false; } }
public String[] getRoleNames(Action action) { String roles = actionRolesMap.get(action.getActionName()); if (roles == null) { return new String[0]; } return roles.split(","); }
public void setPermissions(String siteName, Action action, String[] grantRoleNames, String[] denyRoleNames) { if (action.getParameter() == null) { String roles = StringUtils.join(grantRoleNames, ","); siteService.setSecurity(siteName, action, roles); } else { if (action.getActionName().startsWith("/page/")) { String pagePath = action.getParameter(); // contents.revokePermissions(siteName, pagePath); contents.setPermissions(siteName, pagePath, grantRoleNames, denyRoleNames); } else { throw new UnsupportedOperationException(); } } }
public void setActionRoles(String siteName, Action action, String roles) { ModuleConfigMetadata metadata = getMetadata(siteName); ModuleConfig mconfig = metadata.getModuleConfig(); String actions = actionSecurity.getString(action.getActionName()); String[] actionArray = actions.split(","); for (int i = 0; i < actionArray.length; i++) { try { ActionConfig aconfig = mconfig.findActionConfig(actionArray[i]); aconfig.setRoles(roles); } catch (Exception e) { e.printStackTrace(); } } }
public static Action getAction(String actionName) { int index = ArrayUtils.indexOf(ACTION_NAMES, actionName); if (index >= 0) { return ACTIONS[index]; } return new Action(actionName); } }