作者:程武钢2011 | 来源:互联网 | 2023-09-16 13:16
本文整理了Java中org.geoserver.security.GeoServerUserGroupService.getGroupCount()方法的一些代码示例,
本文整理了Java中org.geoserver.security.GeoServerUserGroupService.getGroupCount()
方法的一些代码示例,展示了GeoServerUserGroupService.getGroupCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoServerUserGroupService.getGroupCount()
方法的具体详情如下:
包路径:org.geoserver.security.GeoServerUserGroupService
类名称:GeoServerUserGroupService
方法名:getGroupCount
GeoServerUserGroupService.getGroupCount介绍
暂无
代码示例
代码示例来源:origin: geoserver/geoserver
public int getGroupCount() throws IOException {
return service.getGroupCount();
}
代码示例来源:origin: geoserver/geoserver
/**
* READ_LOCK
*
* @see org.geoserver.security.GeoServerUserGroupService#getGroupCount()
*/
public int getGroupCount() throws IOException {
readLock();
try {
return getService().getGroupCount();
} finally {
readUnLock();
}
}
/** READ_LOCK */
代码示例来源:origin: geoserver/geoserver
/**
* Additional Validation. Removing this configuration may also remove the file where the users
* and groups are contained. (the file may be stored within the configuration sub directory).
* The design insists on an empty user/group file.
*/
@Override
public void validateRemoveUserGroupService(SecurityUserGroupServiceConfig config)
throws SecurityConfigException {
XMLUserGroupServiceConfig xmlCOnfig= (XMLUserGroupServiceConfig) config;
File file = new File(xmlConfig.getFileName());
// check if if file name is absolute and not in standard role directory
try {
if (file.isAbsolute()
&& !file.getCanonicalPath()
.startsWith(
manager.userGroup()
.get(config.getName())
.file()
.getCanonicalPath()
+ File.separator)) return;
// file in security sub dir, check if roles exists
GeoServerUserGroupService service = manager.loadUserGroupService(config.getName());
if (service.getGroupCount() > 0 || service.getUserCount() > 0) {
throw createSecurityException(USERGROUP_SERVICE_NOT_EMPTY_$1, config.getName());
}
} catch (IOException e) {
throw new RuntimeException();
}
super.validateRemoveUserGroupService(config);
}
代码示例来源:origin: geoserver/geoserver
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());
}
代码示例来源:origin: geoserver/geoserver
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());
}
代码示例来源:origin: geoserver/geoserver
assertEquals(4, userGroupService.getGroupCount());
GeoServerUserGroup admins = userGroupService.getGroupByGroupname("admins");
GeoServerUserGroup group1 = userGroupService.getGroupByGroupname("group1");
代码示例来源:origin: org.geoserver.security/gs-sec-ldap
@Test
public void testGroupCount() throws Exception {
assertEquals(3, service.getGroupCount());
}
代码示例来源:origin: org.geoserver.security/gs-security-tests
store1.store();
assertTrue(service1.getUserGroups().size() == 1);
assertTrue(service1.getGroupCount() == 1);
assertTrue(service2.getGroupCount() == 1);
} finally {
xmlFile.delete();
代码示例来源:origin: org.geoserver.security/gs-security-tests
@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());
}
代码示例来源:origin: org.geoserver.security/gs-security-tests
assertEquals(3, userService.getUserCount());
assertEquals(0, userService.getUserGroups().size());
assertEquals(0, userService.getGroupCount());
代码示例来源:origin: org.geoserver.community/gs-authkey
assertTrue(user.getAuthorities().contains(new GeoServerRole("ROLE_MYROLE_2")));
assertEquals(2, webServiceAuthKeyBodyResponseUGS.getGroupCount());
assertEquals(2, webServiceAuthKeyBodyResponseUGS.getUserGroups().size());
assertEquals(
代码示例来源:origin: org.geoserver.security/gs-security-tests
expect(ugService2.getGroupCount()).andReturn(1).anyTimes();
expect(secMgr.loadUserGroupService("test2")).andReturn(ugService2).anyTimes();