@Override public void actionPerformed(FormEvent event) { ServletRequest request = getRequest(); try { // perform access check SecurityAccess access = acquireAccess(this); if (access == null) { getRequest().setAttribute("SOURCE", this.getClass().getName()); getRequest().setAttribute("MESSAGE", get("IGEO_STD_SEC_ERROR_UNAUTHORIZED_ACCESS")); setNextPage("error.jsp"); return; } checkForAdminRole(access); LinkedList<Service> services = access.getAllServices(); request.setAttribute("SERVICES", services); } catch (GeneralSecurityException e) { getRequest().setAttribute("SOURCE", this.getClass().getName()); getRequest() .setAttribute("MESSAGE", get("IGEO_STD_SEC_FAIL_INIT_SERVICES_EDITOR", e.getMessage())); setNextPage("error.jsp"); LOG.logError(e.getMessage(), e); } catch (Exception e) { LOG.logError(get("IGEO_STD_SEC_ERROR_UNKNOWN", stackTraceToString(e))); getRequest().setAttribute("SOURCE", this.getClass().getName()); getRequest() .setAttribute("MESSAGE", get("IGEO_STD_SEC_FAIL_INIT_SERVICES_EDITOR", e.getMessage())); setNextPage("error.jsp"); } }
/** * Returns the <code>Privileges</code> that the <code>Group</code> has. * * @param securityAccess * @throws GeneralSecurityException */ public Privilege[] getPrivileges(SecurityAccess securityAccess) throws GeneralSecurityException { Role[] roles = securityAccess.getAllRolesForGroup(this); HashSet privilegeSet = new HashSet(); // gather privileges for all associated roles for (int i = 0; i < roles.length; i++) { Privilege[] rolePrivileges = registry.getPrivilegesForRole(securityAccess, roles[i]); for (int j = 0; j < rolePrivileges.length; j++) { privilegeSet.add(rolePrivileges[j]); } } return (Privilege[]) privilegeSet.toArray(new Privilege[privilegeSet.size()]); }
/** * Returns the rights that this <code>Group</code> has on the given <code>SecurableObject</code>. * * @param securityAccess */ public RightSet getRights(SecurityAccess securityAccess, SecurableObject object) throws GeneralSecurityException { Role[] roles = securityAccess.getAllRolesForGroup(this); RightSet rights = null; for (int i = 0; i < roles.length; i++) { Right[] roleRights = registry.getRights(securityAccess, object, roles[i]); switch (i) { case 0: { rights = new RightSet(roleRights); break; } default: { rights.merge(new RightSet(roleRights)); } } } return rights; }