Search in sources :

Example 11 with AgileBaseException

use of com.jeeagile.core.exception.AgileBaseException in project jeeagile by jeeagile.

the class AgileUserDetailsServiceImpl method getUserDataByLoginName.

@Override
public AgileUserData getUserDataByLoginName(String loginName) {
    try {
        AgileSysUser agileSysUser = this.getAgileSysUser(loginName);
        if (agileSysUser == null) {
            throw new AgileAuthException("用户《" + loginName + "》不存在,请核实!");
        }
        this.checkAgileSysUser(agileSysUser);
        return getAgileUserData(agileSysUser);
    } catch (AgileBaseException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new AgileAuthException("加载用户信息异常!");
    }
}
Also used : AgileBaseException(com.jeeagile.core.exception.AgileBaseException) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileBaseException(com.jeeagile.core.exception.AgileBaseException)

Example 12 with AgileBaseException

use of com.jeeagile.core.exception.AgileBaseException in project jeeagile by jeeagile.

the class AgileUserDetailsServiceImpl method getUserRole.

@Override
public List<String> getUserRole(AgileBaseUser agileBaseUser) {
    try {
        if (agileBaseUser != null) {
            if (agileBaseUser.isSuperAdmin()) {
                List<String> userRoleList = new ArrayList<>();
                userRoleList.add("admin");
                return userRoleList;
            } else {
                return agileUserDetailsMapper.getUserRoleByUserId(agileBaseUser.getUserId());
            }
        } else {
            throw new AgileAuthException(AgileResultCode.FAIL_USER_INFO);
        }
    } catch (AgileBaseException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new AgileAuthException("加载用户角色信息异常!");
    }
}
Also used : AgileBaseException(com.jeeagile.core.exception.AgileBaseException) ArrayList(java.util.ArrayList) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileBaseException(com.jeeagile.core.exception.AgileBaseException)

Example 13 with AgileBaseException

use of com.jeeagile.core.exception.AgileBaseException in project jeeagile by jeeagile.

the class AgileUserDetailsServiceImpl method getUserDataByUserId.

@Override
public AgileBaseUser getUserDataByUserId(String userId) {
    try {
        AgileSysUser agileSysUser = agileSysUserService.getById(userId);
        this.checkAgileSysUser(agileSysUser);
        return getAgileUserData(agileSysUserService.getById(userId));
    } catch (AgileBaseException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new AgileAuthException("加载用户信息异常!");
    }
}
Also used : AgileBaseException(com.jeeagile.core.exception.AgileBaseException) AgileSysUser(com.jeeagile.system.entity.AgileSysUser) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileAuthException(com.jeeagile.core.exception.AgileAuthException) AgileBaseException(com.jeeagile.core.exception.AgileBaseException)

Aggregations

AgileBaseException (com.jeeagile.core.exception.AgileBaseException)13 AgileAuthException (com.jeeagile.core.exception.AgileAuthException)11 AgileFrameException (com.jeeagile.core.exception.AgileFrameException)4 AgileBaseUser (com.jeeagile.core.security.user.AgileBaseUser)3 AgileSysUser (com.jeeagile.system.entity.AgileSysUser)3 UserAgent (eu.bitwalker.useragentutils.UserAgent)2 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 AgileDemoException (com.jeeagile.core.exception.AgileDemoException)1 AgileReference (com.jeeagile.core.protocol.annotation.AgileReference)1 AgileResultCode (com.jeeagile.core.result.AgileResultCode)1 IAgileSecurity (com.jeeagile.core.security.IAgileSecurity)1 IAgileUserDetailsService (com.jeeagile.core.security.userdetails.IAgileUserDetailsService)1 AgileAgentUtil (com.jeeagile.core.util.AgileAgentUtil)1 AgileStringUtil (com.jeeagile.core.util.AgileStringUtil)1 AgileServletUtil (com.jeeagile.core.util.spring.AgileServletUtil)1 AgileDemo (com.jeeagile.frame.annotation.AgileDemo)1 AgileUserDetails (com.jeeagile.springsecurity.userdetails.AgileUserDetails)1 Method (java.lang.reflect.Method)1 List (java.util.List)1