@Override public void store() throws IOException { delegateAsStore().store(); }
public void store() throws IOException { getStore().store(); }
/** * WRITE_LOCK * * @see org.geoserver.security.GeoServerUserGroupStore#store() */ public void store() throws IOException { writeLock(); try { getStore().store(); } finally { writeUnLock(); } }
protected void updateUser(String ugService, String userName, boolean enabled) throws Exception { GeoServerUserGroupService ugservice = getSecurityManager().loadUserGroupService(ugService); GeoServerUserGroupStore ugstore = ugservice.createStore(); GeoServerUser u1 = ugstore.getUserByUsername(userName); u1.setEnabled(enabled); ugstore.updateUser(u1); ugstore.store(); }
store.store();
userGroupStore.store();
ugStore.store();
protected void createServices() throws Exception { GeoServerRoleService rservice = createRoleService("rs1"); GeoServerRoleStore rstore = rservice.createStore(); GeoServerRole root, derived; rstore.addRole(root = rstore.createRoleObject(rootRole)); rstore.addRole(derived = rstore.createRoleObject(derivedRole)); rstore.setParentRole(derived, root); rstore.associateRoleToUser(derived, testUserName); rstore.associateRoleToUser(derived, "castest"); rstore.store(); SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig(); mconfig.setRoleServiceName("rs1"); getSecurityManager().saveSecurityConfig(mconfig); GeoServerUserGroupService ugservice = createUserGroupService("ug1"); GeoServerUserGroupStore ugstore = ugservice.createStore(); GeoServerUser u1 = ugstore.createUserObject(testUserName, testPassword, true); ugstore.addUser(u1); GeoServerUser u2 = ugstore.createUserObject("abc@xyz.com", "abc", true); ugstore.addUser(u2); GeoServerUser u3 = ugstore.createUserObject("castest", "castest", true); ugstore.addUser(u3); ugstore.store(); GeoServerAuthenticationProvider prov = createAuthProvider(testProviderName, ugservice.getName()); prepareAuthProviders(prov.getName()); }
@DeleteMapping(value = "/service/{serviceName}/user/{user}") public @ResponseStatus(HttpStatus.OK) void deleteUser( @PathVariable("serviceName") String serviceName, @PathVariable("user") String userName) throws IOException { GeoServerUserGroupStore store = getStore(serviceName); try { store.removeUser(getUser(store, userName)); } finally { store.store(); } }
@PostMapping(value = "/service/{serviceName}/users") public @ResponseStatus(HttpStatus.CREATED) void insertUser( @PathVariable("serviceName") String serviceName, @RequestBody JaxbUser user) throws PasswordPolicyException, IOException { GeoServerUserGroupStore store = getStore(serviceName); try { store.addUser(user.toUser(store)); } finally { store.store(); } }
@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(); } }
@DeleteMapping(value = "/service/{serviceName}/group/{group}") public @ResponseStatus(HttpStatus.OK) void deleteGroup( @PathVariable("serviceName") String serviceName, @PathVariable("group") String groupName) throws IOException { GeoServerUserGroupStore store = getStore(serviceName); try { store.removeGroup(getGroup(store, groupName)); } finally { store.store(); } }
@After public void clearUserGroupService() throws IOException { store.clear(); store.store(); }
@Before public void clearUserGroupService() throws Exception { store.clear(); store.store(); }
@After public void dropExistingTables() throws Exception { if (store != null) { JDBCUserGroupStore jdbcStore = (JDBCUserGroupStore) store; JDBCTestSupport.dropExistingTables(jdbcStore, jdbcStore.getConnection()); store.store(); } }
@Override protected void tearDownInternal() throws Exception { super.tearDownInternal(); if (store!=null) { JDBCUserGroupStore jdbcStore =(JDBCUserGroupStore)store; JDBCTestSupport.dropExistingTables(jdbcStore,jdbcStore.getConnection()); store.store(); } }
@Override protected void tearDownInternal() throws Exception { super.tearDownInternal(); JDBCRoleStore rs = (JDBCRoleStore) roleStore; JDBCTestSupport.dropExistingTables(rs, rs.getConnection()); roleStore.store(); JDBCUserGroupStore ugs = (JDBCUserGroupStore) ugStore; JDBCTestSupport.dropExistingTables(ugs, ugs.getConnection()); ugStore.store(); }
@Before public void removeBill() throws Exception { GeoServerUserGroupStore ugStore = getSecurityManager().loadUserGroupService("gaugs").createStore(); GeoServerUser bill = ugStore.getUserByUsername("bill"); if (bill != null) { ugStore.removeUser(bill); ugStore.store(); } else { ugStore.load(); } }
public void resetUserPassword() throws IOException, PasswordPolicyException { GeoServerUserGroupService service = getSecurityManager().loadUserGroupService(XMLUserGroupService.DEFAULT_NAME); GeoServerUser user = service.getUserByUsername(USERNAME); user.setPassword(USERPW); GeoServerUserGroupStore store = service.createStore(); store.updateUser(user); store.store(); service.load(); }
@Test public void testCreateNewUser() throws Exception { setAuth(); GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); GeoServerUserGroupStore ugStore = ugService.createStore(); GeoServerUser bill = ugStore.createUserObject("bill", "foobar", true); ugStore.addUser(bill); ugStore.store(); assertNotNull(ugService.getUserByUsername("bill")); }