use of com.jeeagile.core.security.user.AgileBaseUser in project jeeagile by jeeagile.
the class AgileSpringSecurity method userLogout.
@Override
public void userLogout() {
AgileBaseUser userData = getUserData();
if (userData != null && AgileStringUtil.isNotEmpty(userData.getUserId())) {
AgileCacheUtil.evict(AgileCacheConstants.AGILE_CACHE_SESSION_NAME, userData.getUserToken());
sessionRegistry.removeSessionInformation(userData.getUserToken());
}
}
use of com.jeeagile.core.security.user.AgileBaseUser in project jeeagile by jeeagile.
the class AgileSysPersonServiceImpl method updatePersonInfo.
@Override
public boolean updatePersonInfo(AgileUpdatePerson agileUpdatePerson) {
AgileBaseUser userData = getCurrentUserData();
AgileSysUser agileSysUser = new AgileSysUser();
BeanUtils.copyProperties(agileUpdatePerson, agileSysUser);
agileSysUser.setId(userData.getUserId());
return agileSysUserService.updateById(agileSysUser);
}
use of com.jeeagile.core.security.user.AgileBaseUser in project jeeagile by jeeagile.
the class AgileSysPersonServiceImpl method updatePersonPwd.
@Override
public boolean updatePersonPwd(AgileUpdatePwd agileUpdatePwd) {
AgileBaseUser userData = getCurrentUserData();
AgileSysUser oldSysUser = agileSysUserService.getById(userData.getUserId());
String oldUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getOldPwd());
String newUserPwd = AgileSecurityUtil.encryptPassword(agileUpdatePwd.getNewPwd());
if (oldSysUser.getUserPwd().equals(oldUserPwd)) {
AgileSysUser newSysUser = new AgileSysUser();
newSysUser.setId(oldSysUser.getId());
newSysUser.setUserPwd(newUserPwd);
return agileSysUserService.updateById(newSysUser);
} else {
throw new AgileValidateException("输入的老密码有误,请确认!");
}
}
use of com.jeeagile.core.security.user.AgileBaseUser in project jeeagile by jeeagile.
the class AgileSysPersonServiceImpl method getPersonInfo.
@Override
public AgilePersonInfo getPersonInfo() {
AgilePersonInfo agilePersonInfo = new AgilePersonInfo();
AgileBaseUser userData = getCurrentUserData();
AgileSysUser agileSysUser = agileSysUserService.getById(userData.getUserId());
if (agileSysUser != null && AgileStringUtil.isNotEmpty(agileSysUser.getId())) {
BeanUtils.copyProperties(agileSysUser, agilePersonInfo);
agilePersonInfo.setDeptName(userData.getDeptName());
List<String> roleNameList = agileSysPersonMapper.getRoleNameByUserId(agileSysUser.getId());
List<String> postNameList = agileSysPersonMapper.getPostNameByUserId(agileSysUser.getId());
agilePersonInfo.setRoleNameList(roleNameList);
agilePersonInfo.setPostNameList(postNameList);
}
return agilePersonInfo;
}
use of com.jeeagile.core.security.user.AgileBaseUser in project jeeagile by jeeagile.
the class AgileAuthorizingRealm method doGetAuthorizationInfo.
/**
* 用户授权
*
* @param principalCollection
* @return
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
try {
AgileBaseUser userData = (AgileBaseUser) principalCollection.getPrimaryPrincipal();
if (userData == null || AgileStringUtil.isEmpty(userData.getUserId())) {
throw new AgileAuthException(AgileResultCode.FAIL_USER_INFO);
}
SimpleAuthorizationInfo authenticationInfo = new SimpleAuthorizationInfo();
List<String> userPermList = userData.getUserPerm();
if (userPermList == null || userPermList.isEmpty()) {
userPermList = agileUserDetailsService.getUserPerm(userData);
userData.setUserPerm(userPermList);
}
authenticationInfo.addStringPermissions(userPermList);
List<String> userRoleList = userData.getUserRole();
if (userRoleList == null || userRoleList.isEmpty()) {
userRoleList = agileUserDetailsService.getUserRole(userData);
userData.setUserRole(userRoleList);
}
authenticationInfo.addRoles(userRoleList);
return authenticationInfo;
} catch (AgileBaseException ex) {
throw ex;
} catch (Exception ex) {
throw new AgileAuthException(AgileResultCode.FAIL_AUTH_EXCEPTION, ex.getMessage());
}
}
Aggregations