Merge pull request #802 from dataease/pr@dev@fix_ldap_support

fix: 修复无插件情况ldap_support报错
This commit is contained in:
fit2cloud-chenyw 2021-09-09 16:31:54 +08:00 committed by GitHub
commit a24e0561ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@ -107,6 +108,8 @@ public class AuthUserServiceImpl implements AuthUserService {
@Override
public boolean supportLdap() {
Map<String, LdapXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((LdapXpackService.class));
if(beansOfType.keySet().size() == 0) return false;
LdapXpackService ldapXpackService = SpringContextUtil.getBean(LdapXpackService.class);
if(ObjectUtils.isEmpty(ldapXpackService)) return false;
return ldapXpackService.isOpen();