/** * Calculate the {@link GeoServerRole} objects for a group including inherited roles * * @param group * @throws IOException */ public SortedSet<GeoServerRole> calculateRoles(GeoServerUserGroup group) throws IOException { SortedSet<GeoServerRole> roles = new TreeSet<GeoServerRole>(); roles.addAll(getRoleService().getRolesForGroup(group.getGroupname())); addInheritedRoles(roles); return roles; }
/** * Implements roles retrieval from the J2EE container. * * @param request * @param principal * @throws IOException */ protected Collection<GeoServerRole> getRolesFromJ2EE( HttpServletRequest request, String principal) throws IOException { Collection<GeoServerRole> roles = new ArrayList<GeoServerRole>(); boolean useActiveService = getRoleServiceName() == null || getRoleServiceName().trim().length() == 0; GeoServerRoleService service = useActiveService ? getSecurityManager().getActiveRoleService() : getSecurityManager().loadRoleService(getRoleServiceName()); for (GeoServerRole role : service.getRoles()) if (request.isUserInRole(role.getAuthority())) roles.add(role); RoleCalculator calc = new RoleCalculator(service); calc.addInheritedRoles(roles); calc.addMappedSystemRoles(roles); return roles; } }
@Override protected List<GeoServerRole> load() { List<GeoServerRole> tmp = new ArrayList<GeoServerRole>(); List<GeoServerRole> result = new ArrayList<GeoServerRole>(); try { GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugServiceName); GeoServerRoleService gaService = getSecurityManager().getActiveRoleService(); RoleCalculator calc = new RoleCalculator(ugService, gaService); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }
@Override protected List<GeoServerRole> load() { List<GeoServerRole> tmp = new ArrayList<GeoServerRole>(); List<GeoServerRole> result = new ArrayList<GeoServerRole>(); try { GeoServerUserGroupService ugService = getSecurityManager() .loadUserGroupService(ugServiceName); GeoServerRoleService gaService = getSecurityManager() .getActiveRoleService(); RoleCalculator calc = new RoleCalculator(ugService, gaService); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }
@Override protected List<GeoServerRole> load() { List<GeoServerRole> tmp = new ArrayList<GeoServerRole>(); List<GeoServerRole> result = new ArrayList<GeoServerRole>(); try { GeoServerUserGroupService ugService = getSecurityManager() .loadUserGroupService(ugServiceName); GeoServerRoleService gaService = getSecurityManager() .getActiveRoleService(); RoleCalculator calc = new RoleCalculator(ugService, gaService); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }