use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class SysUserServiceImpl method detailByUsername.
@Override
public EcBaseServiceResult detailByUsername(SysUserQuery sysUserQuery) {
EcAssert.verifyObjNull(sysUserQuery, "sysUserQuery");
EcAssert.verifyObjNull(sysUserQuery.getUsername(), "sysUserQuery.username");
SysUserDTO sysUserDTO = findByUsername(sysUserQuery.getUsername());
EcAssert.verifyDataNotExistent(sysUserDTO, "sysUserDTO");
return EcBaseServiceResult.newInstanceOfSucResult(sysUserDTO);
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class SysUserRoleServiceImpl method save.
public EcBaseServiceResult save(SysUserRoleDTO sysUserRoleDTO) {
Subject subject = SecurityUtils.getSubject();
SysUserDTO userDTO = (SysUserDTO) subject.getSession().getAttribute("user");
sysUserRoleDTO.setUserId(userDTO.getId());
SysUserRoleEntity sysUserRoleEntity = EcJSONUtils.parseObject(sysUserRoleDTO, SysUserRoleEntity.class);
sysUserRoleDAO.save(sysUserRoleEntity);
return EcBaseServiceResult.newInstanceOfSucResult(sysUserRoleEntity);
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class SysRoleController method getCurrentUserRole.
@RequestMapping(value = "getCurrentUserRole")
public EcBaseServiceResult getCurrentUserRole() {
Subject subject = SecurityUtils.getSubject();
SysUserDTO sysUserDTO = (SysUserDTO) subject.getPrincipal();
return EcBaseServiceResult.newInstanceOfSucResult(sysRoleService.findByUserId(sysUserDTO.getId()));
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class EcBaseLoginFilter method isAccessAllowed.
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
Object loginInfo = request.getAttribute(EcAuthorityConstant.LOGIN_INFO);
if (EcBaseUtils.isNotNull(loginInfo)) {
return true;
}
String loginName = request.getParameter(EcAuthorityConstant.LOGIN_NAME);
SysUserDTO authCachePrincipal = (SysUserDTO) getAuthCachePrincipal(loginName);
if (authCachePrincipal != null) {
Subject subject = getSubject(request, response);
authCachePrincipal.setPassword(request.getParameter("password"));
getSysUserService().login(subject, authCachePrincipal);
EcLogUtils.info("获取数据成功", authCachePrincipal, logger);
request.setAttribute(EcAuthorityConstant.USERNAME, authCachePrincipal.getAuthCacheKey());
request.setAttribute(EcAuthorityConstant.LOGIN_INFO, authCachePrincipal);
EcRequestUtils.printForJson(request, response, EcBaseServiceResult.newInstanceOfSuccess());
return false;
}
return true;
}
use of com.easy.cloud.core.operator.sysuser.pojo.dto.SysUserDTO in project dq-easy-cloud by dq-open-cloud.
the class EcMonitorController method login.
@RequestMapping(value = "login", method = RequestMethod.POST)
public String login(HttpServletRequest request, @RequestParam(name = "username") String username, @RequestParam(name = "password") String password) {
request.setAttribute(EcAuthorityConstant.USERNAME, username);
SysUserDTO sysUserDTO = new SysUserDTO();
sysUserDTO.setUsername(username);
sysUserDTO.setPassword(password);
sysUserService.login(request, sysUserDTO);
return "redirect:" + adminServerProperties.getContextPath();
}
Aggregations