@Test public void testSearchBambooGroup() { List<String> groups = authService.searchBambooGroup(); for (String group : groups) { System.err.println(group); } }
@Override public List<String> searchBambooGroup() { HashMap<String, String> configMap = acqConfigMap(); String groupDN = configMap.get(LdapItemEnum.LDAP_GROUP_DN.getItemKey()); String groupFilter = configMap.get(LdapItemEnum.LDAP_GROUP_FILTER.getItemKey()); List<String> groups = Collections.EMPTY_LIST; try { groups = ldapFactory.getLdapTemplateInstanceByType(LdapDO.LdapTypeEnum.cmdb.getDesc()).search(LdapQueryBuilder.query().base(groupDN) .where("objectClass").is("groupOfUniqueNames").and("cn").like(groupFilter + "*"), new AttributesMapper<String>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get(0).toString(); } } ); } catch (Exception e) { logger.warn("search bamboo group error={}", e.getMessage(), e); } return groups; }
AuthServiceImpl implements AuthService, InitializingBean { @Override public List<String> searchBambooGroup() { HashMap<String, String> configMap = acqConfigMap(); String groupDN = configMap.get(LdapItemEnum.LDAP_GROUP_DN.getItemKey()); String groupFilter = configMap.get(LdapItemEnum.LDAP_GROUP_FILTER.getItemKey()); List<String> groups = Collections.EMPTY_LIST; try { groups = ldapFactory.getLdapTemplateInstanceByType(LdapDO.LdapTypeEnum.cmdb.getDesc()).search(LdapQueryBuilder.query().base(groupDN) .where("objectClass").is("groupOfUniqueNames").and("cn").like(groupFilter + "*"), new AttributesMapper<String>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get(0).toString(); } } ); } catch (Exception e) { logger.warn("search bamboo group error={}", e.getMessage(), e); } return groups; } }
AuthServiceImpl implements AuthService, InitializingBean { @Override public List<String> searchBambooGroup() { HashMap<String, String> configMap = acqConfigMap(); String groupDN = configMap.get(LdapItemEnum.LDAP_GROUP_DN.getItemKey()); String groupFilter = configMap.get(LdapItemEnum.LDAP_GROUP_FILTER.getItemKey()); List<String> groups = Collections.EMPTY_LIST; try { groups = ldapFactory.getLdapTemplateInstanceByType(LdapDO.LdapTypeEnum.cmdb.getDesc()).search(LdapQueryBuilder.query().base(groupDN) .where("objectClass").is("groupOfUniqueNames").and("cn").like(groupFilter + "*"), new AttributesMapper<String>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get(0).toString(); } } ); } catch (Exception e) { logger.warn("search bamboo group error={}", e.getMessage(), e); } return groups; }  }
AuthServiceImpl implements AuthService, InitializingBean { @Override public List<String> searchBambooGroup() { HashMap<String, String> configMap = acqConfigMap(); String groupDN = configMap.get(LdapItemEnum.LDAP_GROUP_DN.getItemKey()); String groupFilter = configMap.get(LdapItemEnum.LDAP_GROUP_FILTER.getItemKey()); List<String> groups = Collections.EMPTY_LIST; try { groups = ldapFactory.getLdapTemplateInstanceByType(LdapDO.LdapTypeEnum.cmdb.getDesc()).search(LdapQueryBuilder.query().base(groupDN) .where("objectClass").is("groupOfUniqueNames").and("cn").like(groupFilter + "*"), new AttributesMapper<String>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get(0).toString(); } } ); } catch (Exception e) { logger.warn("search bamboo group error={}", e.getMessage(), e); } return groups; }  @Override BusinessWrapper<UserDO> loginCredentialCheck(String username, String password); @Override BusinessWrapper<Boolean> logout(String username); @Override String getUserByToken(String token); @Override BusinessWrapper<Boolean> checkUserHasResourceAuthorize(String token, String resourceName); @Override BusinessWrapper<List<ResourceDO>> checkAndGetUserHasResourceAuthorize(String token, String resourceName, List<String> authGroupList); @Override TableVO<List<ResourceGroupDO>> getResourceGroups(String groupCode, int page, int length); @Override BusinessWrapper<Boolean> saveResourceGroup(ResourceGroupDO resourceGroupDO); @Override BusinessWrapper<Boolean> delResourceGroup(long groupId); @Override TableVO<List<ResourceVO>> getResources(long groupId, String resourceName, int authType, int page, int length); @Override BusinessWrapper<Boolean> saveResource(ResourceVO resourceVO); @Override BusinessWrapper<Boolean> delResource(long resourceId); @Override RoleDO getRoleById(long roleId); @Override TableVO<List<RoleDO>> getRoles(long resourceId, String roleName, int page, int length); @Override BusinessWrapper<Boolean> saveRole(RoleDO roleDO); @Override BusinessWrapper<Boolean> delRole(long roleId); @Override TableVO<List<ResourceVO>> getRoleBindResources(long roleId, long resourceGroupId, int page, int length); @Override TableVO<List<ResourceVO>> getRoleUnbindResources(long roleId, long resourceGroupId, int page, int length); @Override BusinessWrapper<Boolean> roleResourceBind(long roleId, long resourceId); @Override BusinessWrapper<Boolean> roleResourceUnbind(long roleId, long resourceId); @Override TableVO<List<UserVO>> getUsers(String username, long roleId, int page, int length); @Override BusinessWrapper<Boolean> userRoleBind(long roleId, String username); @Override BusinessWrapper<Boolean> userRoleUnbind(long roleId, String username); @Override List<String> getUserGroup(String username); @Override List<Long> getUserGroupIds(String username); @Override List<Long> getUserRoleIds(String username); @Override UserDO getUserByName(String username); @Override List<UserDO> getUsersByRole(long roleId); @Override BusinessWrapper<Boolean> unbindUser(String username); @Override BusinessWrapper<Boolean> delUser(String username); @Override BusinessWrapper<Boolean> leaving(String username); @Override void afterPropertiesSet(); @Override List<String> searchBambooGroupFilter(String username); @Override List<String> searchLdapGroup(String username); @Override boolean isJiraUsers(String username); @Override boolean isConfluenceUsers(String username); @Override boolean isGroupMember(String username, String groupName); @Override BusinessWrapper<Boolean> resetToken(); @Override boolean checkUserInLdapGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean addMemberToGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean addMemberToGroup(UserDO userDO, String groupName); boolean checkUserInLdapGroup(UserDO userDO, String groupName); @Override boolean delMemberToGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean delMemberToGroup(UserDO userDO, String groupName); @Override boolean removeMember2Group(String username, String groupName); @Override BusinessWrapper<Boolean> removeMember2Group(String username); BusinessWrapper<Boolean> addUser(UserDO userDO); @Override BusinessWrapper<Boolean> closeMailAccount(String username); @Override BusinessWrapper<Boolean> activeMailAccount(String username); @Override BusinessWrapper<Boolean> addLdapGroup(String username, String groupname); @Override BusinessWrapper<Boolean> delLdapGroup(String username, String groupname); @Override boolean setMailUserAccountStatus(UserDO userDO, String status); @Override String getMailAccountStatus(String mail); @Override boolean checkUserInLdap(String username); @Override String getAccountLocked(String username); @Override List<String> searchBambooGroup(); @Override List<UserDO> queryUsersByRoleName(String roleName); }
AuthServiceImpl implements AuthService, InitializingBean { @Override public List<String> searchBambooGroup() { HashMap<String, String> configMap = acqConfigMap(); String groupDN = configMap.get(LdapItemEnum.LDAP_GROUP_DN.getItemKey()); String groupFilter = configMap.get(LdapItemEnum.LDAP_GROUP_FILTER.getItemKey()); List<String> groups = Collections.EMPTY_LIST; try { groups = ldapFactory.getLdapTemplateInstanceByType(LdapDO.LdapTypeEnum.cmdb.getDesc()).search(LdapQueryBuilder.query().base(groupDN) .where("objectClass").is("groupOfUniqueNames").and("cn").like(groupFilter + "*"), new AttributesMapper<String>() { @Override public String mapFromAttributes(Attributes attributes) throws NamingException { return attributes.get("cn").get(0).toString(); } } ); } catch (Exception e) { logger.warn("search bamboo group error={}", e.getMessage(), e); } return groups; }  @Override BusinessWrapper<UserDO> loginCredentialCheck(String username, String password); @Override BusinessWrapper<Boolean> logout(String username); @Override String getUserByToken(String token); @Override BusinessWrapper<Boolean> checkUserHasResourceAuthorize(String token, String resourceName); @Override BusinessWrapper<List<ResourceDO>> checkAndGetUserHasResourceAuthorize(String token, String resourceName, List<String> authGroupList); @Override TableVO<List<ResourceGroupDO>> getResourceGroups(String groupCode, int page, int length); @Override BusinessWrapper<Boolean> saveResourceGroup(ResourceGroupDO resourceGroupDO); @Override BusinessWrapper<Boolean> delResourceGroup(long groupId); @Override TableVO<List<ResourceVO>> getResources(long groupId, String resourceName, int authType, int page, int length); @Override BusinessWrapper<Boolean> saveResource(ResourceVO resourceVO); @Override BusinessWrapper<Boolean> delResource(long resourceId); @Override RoleDO getRoleById(long roleId); @Override TableVO<List<RoleDO>> getRoles(long resourceId, String roleName, int page, int length); @Override BusinessWrapper<Boolean> saveRole(RoleDO roleDO); @Override BusinessWrapper<Boolean> delRole(long roleId); @Override TableVO<List<ResourceVO>> getRoleBindResources(long roleId, long resourceGroupId, int page, int length); @Override TableVO<List<ResourceVO>> getRoleUnbindResources(long roleId, long resourceGroupId, int page, int length); @Override BusinessWrapper<Boolean> roleResourceBind(long roleId, long resourceId); @Override BusinessWrapper<Boolean> roleResourceUnbind(long roleId, long resourceId); @Override TableVO<List<UserVO>> getUsers(String username, long roleId, int page, int length); @Override BusinessWrapper<Boolean> userRoleBind(long roleId, String username); @Override BusinessWrapper<Boolean> userRoleUnbind(long roleId, String username); @Override List<String> getUserGroup(String username); @Override List<Long> getUserGroupIds(String username); @Override List<Long> getUserRoleIds(String username); @Override UserDO getUserByName(String username); @Override List<UserDO> getUsersByRole(long roleId); @Override BusinessWrapper<Boolean> unbindUser(String username); @Override BusinessWrapper<Boolean> delUser(String username); @Override BusinessWrapper<Boolean> leaving(String username); @Override void afterPropertiesSet(); @Override List<String> searchBambooGroupFilter(String username); @Override List<String> searchLdapGroup(String username); @Override boolean isJiraUsers(String username); @Override boolean isConfluenceUsers(String username); @Override boolean isGroupMember(String username, String groupName); @Override BusinessWrapper<Boolean> resetToken(); @Override boolean checkUserInLdapGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean addMemberToGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean addMemberToGroup(UserDO userDO, String groupName); boolean checkUserInLdapGroup(UserDO userDO, String groupName); @Override boolean delMemberToGroup(UserDO userDO, ServerGroupDO serverGroupDO); @Override boolean delMemberToGroup(UserDO userDO, String groupName); @Override boolean removeMember2Group(String username, String groupName); @Override BusinessWrapper<Boolean> removeMember2Group(String username); BusinessWrapper<Boolean> addUser(UserDO userDO); @Override BusinessWrapper<Boolean> closeMailAccount(String username); @Override BusinessWrapper<Boolean> activeMailAccount(String username); @Override BusinessWrapper<Boolean> addLdapGroup(String username, String groupname); @Override BusinessWrapper<Boolean> delLdapGroup(String username, String groupname); @Override boolean setMailUserAccountStatus(UserDO userDO, String status); @Override String getMailAccountStatus(String mail); @Override boolean checkUserInLdap(String username); @Override String getAccountLocked(String username); @Override List<String> searchBambooGroup(); @Override List<UserDO> queryUsersByRoleName(String roleName); static final String MAIL_ACCOUNT_STATUS_CLOSED; static final String MAIL_ACCOUNT_STATUS_LOCKED; static final String MAIL_ACCOUNT_STATUS_ACTIVE; }