public GeoServerUserGroup(GeoServerUserGroup other) { this.groupname = other.getGroupname(); this.enabled = other.isEnabled(); }
groups.appendChild(group); group.setAttribute(A_GROUP_NAME_UR, groupObject.getGroupname()); group.setAttribute(A_GROUP_ENABLED_UR, groupObject.isEnabled() ? "true" : "false"); SortedSet<GeoServerUser> userObjects = helper.group_userMap.get(groupObject); if (userObjects != null) {
if (group.isEnabled()) set1.addAll(calculateRoles(group));
store.createGroupObject(group.getGroupname(), group.isEnabled()); store.addGroup(newGroup); newGroupDict.put(newGroup.getGroupname(), newGroup);
protected void checkValuesModified(GeoServerUserGroupService userGroupService) throws IOException { GeoServerUser disableduser = userGroupService.getUserByUsername("disableduser"); assertTrue(disableduser.isEnabled()); GeoServerMultiplexingPasswordEncoder encoder = getEncoder(userGroupService); assertTrue(encoder.isPasswordValid(disableduser.getPassword(), "hallo", null)); assertEquals(1, disableduser.getProperties().size()); assertEquals("miller", disableduser.getProperties().getProperty("lastname")); GeoServerUser user2 = userGroupService.getUserByUsername("user2"); assertEquals(1, user2.getProperties().size()); assertEquals("11-22-33", user2.getProperties().getProperty("tel")); GeoServerUserGroup disabledgroup = userGroupService.getGroupByGroupname("disabledgroup"); assertTrue(disabledgroup.isEnabled()); GeoServerUserGroup group1 = userGroupService.getGroupByGroupname("group1"); GeoServerUser user1 = userGroupService.getUserByUsername("user1"); assertEquals(1, userGroupService.getUsersForGroup(group1).size()); assertTrue(userGroupService.getUsersForGroup(group1).contains(user1)); assertEquals(0, userGroupService.getGroupsForUser(user2).size()); assertEquals(0, userGroupService.getUsersHavingProperty("mail").size()); assertEquals(0, userGroupService.getUsersHavingPropertyValue("tel", "12-34-38").size()); assertEquals(1, userGroupService.getUsersHavingPropertyValue("tel", "11-22-33").size()); user2 = userGroupService.getUsersHavingPropertyValue("tel", "11-22-33").first(); assertEquals("11-22-33", user2.getProperties().getProperty("tel")); }
public void updateGroup(GeoServerUserGroup group) throws IOException { Connection con = null; PreparedStatement ps = null; try { con = getConnection(); ps = getDMLStatement("groups.update", con); ps.setString(1,convertToString(group.isEnabled())); ps.setString(2,group.getGroupname()); ps.execute(); } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, null); } setModified(true); }
public void addGroup(GeoServerUserGroup group) throws IOException { Connection con = null; PreparedStatement ps = null; try { con = getConnection(); ps = getDMLStatement("groups.insert", con); ps.setString(1,group.getGroupname()); ps.setString(2,convertToString(group.isEnabled())); ps.execute(); } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, null); } setModified(true); }
@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; } }
for (GeoServerUserGroup group : userGroupService.getGroupsForUser(user)) { if (group.isEnabled()) { for (GeoServerRole role : calc.calculateRoles(group)) { stringSet.add(role.getAuthority()); for (GeoServerUserGroup group : userGroupService.getGroupsForUser(user)) { if (group.isEnabled()) { for (GeoServerRole role : calc.calculateRoles(group)) { stringSet.add(role.getAuthority());
@Override protected void onFormSubmit(GeoServerUserGroup group) throws IOException { GeoServerUserGroupStore store=null; try { store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(),group.isEnabled()); store.addGroup(group); store.store(); } catch (IOException ex) { try { store.load(); } catch (IOException ex2) {}; throw ex; } GeoServerRoleStore gaStore=null; try { if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) { gaStore = getRoleStore(getSecurityManager().getActiveRoleService().getName()); gaStore = new RoleStoreValidationWrapper(gaStore); for (GeoServerRole role : rolePalette.getSelectedRoles()) { gaStore.associateRoleToGroup(role, group.getGroupname()); } gaStore.store(); } } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw ex; } }
@Override protected void onFormSubmit(GeoServerUserGroup group) throws IOException { GeoServerUserGroupStore store=null; try { store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(),group.isEnabled()); store.addGroup(group); store.store(); } catch (IOException ex) { try { store.load(); } catch (IOException ex2) {}; throw ex; } GeoServerRoleStore gaStore=null; try { if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) { gaStore = getRoleStore(getSecurityManager().getActiveRoleService().getName()); gaStore = new RoleStoreValidationWrapper(gaStore); for (GeoServerRole role : rolePalette.getSelectedRoles()) { gaStore.associateRoleToGroup(role, group.getGroupname()); } gaStore.store(); } } catch (IOException ex) { try {gaStore.load(); } catch (IOException ex2) {}; throw ex; } }
try { store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(), group.isEnabled()); store.addGroup(group); store.store();