public SortedSet<GeoServerUserGroup> getUserGroups() throws IOException { return service.getUserGroups(); }
@Override public SortedSet<GeoServerUserGroup> getUserGroups() throws IOException { return filterGroups(new TreeSet<GeoServerUserGroup>(delegate.getUserGroups())); }
/** * READ_LOCK * * @see org.geoserver.security.GeoServerUserGroupService#getUserGroups() */ public SortedSet<GeoServerUserGroup> getUserGroups() throws IOException { readLock(); try { return getService().getUserGroups(); } finally { readUnLock(); } }
newUserDict.put(newUser.getUsername(), newUser); for (GeoServerUserGroup group : service.getUserGroups()) { GeoServerUserGroup newGroup = store.createGroupObject(group.getGroupname(), group.isEnabled()); newGroupDict.put(newGroup.getGroupname(), newGroup); for (GeoServerUserGroup group : service.getUserGroups()) { GeoServerUserGroup newGroup = newGroupDict.get(group.getGroupname());
protected void checkEmpty(GeoServerUserGroupService userService) throws IOException { assertEquals(0, userService.getUsers().size()); assertEquals(0, userService.getUserGroups().size()); assertEquals(0, userService.getUserCount()); assertEquals(0, userService.getGroupCount()); }
protected void checkValuesRemoved(GeoServerUserGroupService userGroupService) throws IOException { GeoServerUser admin = GeoServerUser.createDefaultAdmin(); GeoServerUser user1 = userGroupService.getUserByUsername("user1"); GeoServerUser disableduser = userGroupService.getUserByUsername("disableduser"); GeoServerUser groupAdminUser = userGroupService.getUserByUsername("groupAdminUser"); assertEquals(4, userGroupService.getUsers().size()); assertEquals(4, userGroupService.getUserCount()); assertTrue(userGroupService.getUsers().contains(admin)); assertTrue(userGroupService.getUsers().contains(user1)); assertTrue(userGroupService.getUsers().contains(disableduser)); assertTrue(userGroupService.getUsers().contains(groupAdminUser)); GeoServerUserGroup admins = userGroupService.getGroupByGroupname("admins"); GeoServerUserGroup group1 = userGroupService.getGroupByGroupname("group1"); assertEquals(3, userGroupService.getUserGroups().size()); assertEquals(3, userGroupService.getGroupCount()); assertTrue(userGroupService.getUserGroups().contains(admins)); assertTrue(userGroupService.getUserGroups().contains(group1)); assertEquals(0, userGroupService.getGroupsForUser(disableduser).size()); assertEquals(1, userGroupService.getUsersForGroup(group1).size()); assertTrue(userGroupService.getUsersForGroup(group1).contains(user1)); assertEquals(0, userGroupService.getUsersHavingProperty("mail").size()); assertEquals(0, userGroupService.getUsersHavingPropertyValue("tel", "11-22-33").size()); }
assertEquals(user2.getProperties().getProperty("tel"), "12-34-38"); assertEquals(4, userGroupService.getUserGroups().size()); assertEquals(4, userGroupService.getGroupCount()); GeoServerUserGroup admins = userGroupService.getGroupByGroupname("admins"); assertTrue(userGroupService.getUserGroups().contains(admins)); assertTrue(userGroupService.getUserGroups().contains(group1)); assertTrue(userGroupService.getUserGroups().contains(group2)); assertTrue(userGroupService.getUserGroups().contains(disabledgroup));
@GetMapping( value = "/service/{serviceName}/groups", produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE} ) public JaxbGroupList getGroups(@PathVariable("serviceName") String serviceName) throws IOException { return new JaxbGroupList(getService(serviceName).getUserGroups()); }
@Override protected List<GeoServerUserGroup> getItems() { SortedSet<GeoServerUserGroup> groups = null; try { GeoServerUserGroupService service = null; if (userGroupServiceName != null) service = getApplication() .getSecurityManager() .loadUserGroupService(userGroupServiceName); if (service == null) groups = new TreeSet<GeoServerUserGroup>(); else groups = service.getUserGroups(); } catch (IOException e) { throw new RuntimeException(e); } List<GeoServerUserGroup> groupList = new ArrayList<GeoServerUserGroup>(); groupList.addAll(groups); return groupList; }
@Override protected List<GeoServerUserGroup> getItems() { SortedSet<GeoServerUserGroup> groups=null; try { GeoServerUserGroupService service = null; if (userGroupServiceName!=null) service = getApplication().getSecurityManager().loadUserGroupService(userGroupServiceName); if (service==null) groups=new TreeSet<GeoServerUserGroup>(); else groups=service.getUserGroups(); } catch (IOException e) { throw new RuntimeException(e); } List<GeoServerUserGroup> groupList = new ArrayList<GeoServerUserGroup>(); groupList.addAll(groups); return groupList; }
@Override protected List<GeoServerUserGroup> getItems() { SortedSet<GeoServerUserGroup> groups=null; try { GeoServerUserGroupService service = null; if (userGroupServiceName!=null) service = getApplication().getSecurityManager().loadUserGroupService(userGroupServiceName); if (service==null) groups=new TreeSet<GeoServerUserGroup>(); else groups=service.getUserGroups(); } catch (IOException e) { throw new RuntimeException(e); } List<GeoServerUserGroup> groupList = new ArrayList<GeoServerUserGroup>(); groupList.addAll(groups); return groupList; }
@Override protected List<GeoServerUserGroup> load() { GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager(); try { return new ArrayList(secMgr.loadUserGroupService(userGroupServiceName).getUserGroups()); } catch(IOException e) { throw new WicketRuntimeException(e); } }
@Override protected List<GeoServerUserGroup> load() { GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager(); try { return new ArrayList(secMgr.loadUserGroupService(userGroupServiceName).getUserGroups()); } catch (IOException e) { throw new WicketRuntimeException(e); } } }
@Override protected List<GeoServerUserGroup> load() { GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager(); try { return new ArrayList(secMgr.loadUserGroupService(userGroupServiceName).getUserGroups()); } catch(IOException e) { throw new WicketRuntimeException(e); } }
@Test public void testHideGroups() throws Exception { GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); assertTrue(ugService.getUserGroups().contains(users)); assertNotNull(ugService.getGroupByGroupname("users")); assertTrue(ugService.getUserGroups().contains(admins)); assertNotNull(ugService.getGroupByGroupname("admins")); setAuth(); ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); assertTrue(ugService.getUserGroups().contains(users)); assertNotNull(ugService.getGroupByGroupname("users")); assertFalse(ugService.getUserGroups().contains(admins)); assertNull(ugService.getGroupByGroupname("admins")); }
assertTrue(service1.getUserGroups().size() == 1); assertTrue(service1.getGroupCount() == 1); assertTrue(service2.getUserGroups().size() == 1); assertTrue(service2.getGroupCount() == 1); } finally {
@Test public void testDefault() throws Exception { GeoServerUserGroupService service = getSecurityManager().loadUserGroupService(XMLUserGroupService.DEFAULT_NAME); assertEquals(1, service.getUsers().size()); assertEquals(1, service.getUserCount()); assertEquals(0, service.getUserGroups().size()); assertEquals(0, service.getGroupCount()); GeoServerUser admin = service.getUserByUsername(GeoServerUser.ADMIN_USERNAME); assertNotNull(admin); assertEquals(GeoServerUser.AdminEnabled, admin.isEnabled()); GeoServerMultiplexingPasswordEncoder enc = getEncoder(service); assertTrue( enc.isPasswordValid(admin.getPassword(), GeoServerUser.DEFAULT_ADMIN_PASSWD, null)); assertEquals(admin.getProperties().size(), 0); assertEquals(0, service.getGroupsForUser(admin).size()); }
assertEquals(2, webServiceAuthKeyBodyResponseUGS.getUserGroups().size()); assertEquals( webServiceAuthKeyBodyResponseUGS.getUserGroups(), webServiceAuthKeyBodyResponseUGS.getGroupsForUser(user));
assertEquals(0, userService.getUserGroups().size()); assertEquals(0, userService.getGroupCount());