public GeoServerUser createUserObject(String username, String password, boolean isEnabled) throws IOException { return service.createUserObject(username, password, isEnabled); }
@Override public GeoServerUser createUserObject(String username, String password, boolean isEnabled) throws IOException { return filterUser(delegate.createUserObject(username, password, isEnabled)); }
/** * READ_LOCK * * @see org.geoserver.security.GeoServerUserGroupService#createUserObject(java.lang.String, * java.lang.String, boolean) */ public GeoServerUser createUserObject(String username, String password, boolean isEnabled) throws IOException { readLock(); try { return getService().createUserObject(username, password, isEnabled); } finally { readUnLock(); } }
public GeoServerUser toUser(GeoServerUserGroupService service) throws IOException { return service.createUserObject(userName, password, enabled); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // Create the test restuser if needed GeoServerUserGroupService service = getSecurityManager().loadUserGroupService(XMLUserGroupService.DEFAULT_NAME); if (service.getUserByUsername(USERNAME) == null) { GeoServerUser user = service.createUserObject(USERNAME, USERPW, true); GeoServerUserGroupStore store = service.createStore(); store.addUser(user); store.store(); service.load(); } xp = XMLUnit.newXpathEngine(); }
SortedSet<GeoServerRole> roles; roles = calc.calculateRoles(ugService.createUserObject("user1", "abc", true)); assertTrue(roles.size() == 4); assertTrue(roles.contains(adminRole)); assertTrue(roles.contains(GeoServerRole.GROUP_ADMIN_ROLE)); roles = calc.calculateRoles(ugService.createUserObject("user2", "abc", true)); assertTrue(roles.size() == 2); assertTrue(roles.contains(adminRole)); assertTrue(roles.contains(GeoServerRole.ADMIN_ROLE)); roles = calc.calculateRoles(ugService.createUserObject("user3", "abc", true)); assertTrue(roles.size() == 1); assertTrue(roles.contains(role1));
@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(); }