@Override public void addGroup(GeoServerUserGroup group) throws IOException { if (filterGroup(group) != null) { delegateAsStore().addGroup(group); } }
public void addGroup(GeoServerUserGroup group) throws IOException { checkNotExistingGroupName(group.getGroupname()); getStore().addGroup(group); }
/** * WRITE_LOCK * * @see * org.geoserver.security.GeoServerUserGroupStore#addGroup(org.geoserver.security.impl.GeoServerUserGroup) */ public void addGroup(GeoServerUserGroup group) throws IOException { writeLock(); try { getStore().addGroup(group); } finally { writeUnLock(); } }
GeoServerUserGroup newGroup = store.createGroupObject(group.getGroupname(), group.isEnabled()); store.addGroup(newGroup); newGroupDict.put(newGroup.getGroupname(), newGroup);
if (group == null) { group = ugStore.createGroupObject(groupName, true); ugStore.addGroup(group);
@PostMapping(value = "/service/{serviceName}/group/{group}") public @ResponseStatus(HttpStatus.CREATED) void insertGroup( @PathVariable("serviceName") String serviceName, @PathVariable("group") String groupName) throws PasswordPolicyException, IOException { GeoServerUserGroupStore store = getStore(serviceName); try { store.addGroup(new GeoServerUserGroup(groupName)); } finally { store.store(); } }
store1.addGroup(group); store1.store(); assertTrue(service1.getUserGroups().size() == 1);
@Override protected void onSetUp(SystemTestData testData) throws Exception { addUser("pippo", "clown", null, Arrays.asList("CIRCUS", "KLINIEK", "ZEVER")); addUser("jantje", "jantje", null, Arrays.asList("MOPJES", "ZEVER")); GeoServerSecurityManager secMgr = getSecurityManager(); GeoServerUserGroupService userGroupService = secMgr.loadUserGroupService("default"); GeoServerRoleService roleService = secMgr.loadRoleService("default"); GeoServerUserGroupStore userGroupStore = userGroupService.createStore(); GeoServerRoleStore rolesStore = roleService.createStore(); GeoServerUser roleUserTest = userGroupService.createUserObject("role_user_test", "role_user_test", true); userGroupStore.addUser(roleUserTest); GeoServerRole roleTest = rolesStore.createRoleObject("ROLE_TEST"); rolesStore.addRole(roleTest); rolesStore.associateRoleToUser(roleTest, "role_user_test"); GeoServerRole roleTest2 = rolesStore.createRoleObject("ROLE_TEST_2"); rolesStore.addRole(roleTest2); GeoServerUserGroup roleGroup = userGroupService.createGroupObject("ROLE_GROUP", true); userGroupStore.addGroup(roleGroup); userGroupStore.associateUserToGroup(roleUserTest, roleGroup); rolesStore.associateRoleToGroup(roleTest2, "ROLE_GROUP"); userGroupStore.store(); rolesStore.store(); }
@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; } }
} catch (IOException ex1) { try { store2.addGroup(group); } catch (IOException ex2) { fail = false;
store = new UserGroupStoreValidationWrapper(getUserGroupStore(userGroupServiceName)); group = store.createGroupObject(group.getGroupname(), group.isEnabled()); store.addGroup(group); store.store(); } catch (IOException ex) {
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // set up the services GeoServerUserGroupService ugService = createUserGroupService("gaugs"); GeoServerRoleService roleService = createRoleService("gars"); getSecurityManager().setActiveRoleService(roleService); // add the users GeoServerUserGroupStore ugStore = createStore(ugService); GeoServerUser bob = ugStore.createUserObject("bob", "foobar", true); GroupAdminProperty.set(bob.getProperties(), new String[] {"users"}); ugStore.addUser(bob); GeoServerUser alice = ugStore.createUserObject("alice", "foobar", true); ugStore.addUser(alice); GeoServerUserGroup users = ugStore.createGroupObject("users", true); ugStore.addGroup(users); GeoServerUserGroup admins = ugStore.createGroupObject("admins", true); ugStore.addGroup(admins); ugStore.store(); // grant bob group admin privilege GeoServerRole groupAdminRole = null; GeoServerRoleStore roleStore = createStore(roleService); roleStore.addRole(roleStore.createRoleObject("adminRole")); roleStore.addRole(groupAdminRole = roleStore.createRoleObject("groupAdminRole")); roleStore.associateRoleToUser(groupAdminRole, bob.getUsername()); roleStore.store(); }
store.addGroup(group); assertTrue(store.isModified()); store.store();