use of org.maxkey.entity.UserInfo in project MaxKey by dromara.
the class UserInfoController method forwardChangePassword.
@RequestMapping(value = { "/forwardChangePassword/{id}" })
public ModelAndView forwardChangePassword(@PathVariable("id") String id) {
ModelAndView modelAndView = new ModelAndView("/userinfo/changePassword");
UserInfo userInfo = userInfoService.get(id);
modelAndView.addObject("model", userInfo);
return modelAndView;
}
use of org.maxkey.entity.UserInfo in project MaxKey by dromara.
the class AccountsController method generate.
@ResponseBody
@RequestMapping(value = "/generate")
public String generate(@ModelAttribute("appAccounts") Accounts appAccounts) {
AccountsStrategy accountsStrategy = accountsStrategyService.get(appAccounts.getStrategyId());
UserInfo userInfo = userInfoService.get(appAccounts.getUserId());
return accountsService.generateAccount(userInfo, accountsStrategy);
}
use of org.maxkey.entity.UserInfo in project MaxKey by dromara.
the class LoginSessionController method deleteUsersById.
@ResponseBody
@RequestMapping(value = "/terminate")
public Message deleteUsersById(@RequestParam("id") String ids) {
_logger.debug(ids);
boolean isTerminated = false;
try {
String currentUserSessionId = "";
if (WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID) != null) {
currentUserSessionId = WebContext.getAttribute(WebConstants.CURRENT_USER_SESSION_ID).toString();
}
for (String sessionId : StringUtils.string2List(ids, ",")) {
_logger.trace("terminate session Id {} ", sessionId);
if (currentUserSessionId.contains(sessionId)) {
// skip current session
continue;
}
UserInfo userInfo = WebContext.getUserInfo();
String lastLogoffTime = DateUtils.formatDateTime(new Date());
loginRepository.updateLastLogoff(userInfo);
loginHistoryRepository.logoff(lastLogoffTime, sessionId);
onlineTicketServices.remove("OT-" + sessionId);
}
isTerminated = true;
} catch (Exception e) {
_logger.debug("terminate Exception .", e);
}
if (isTerminated) {
return new Message(WebContext.getI18nValue(ConstsOperateMessage.DELETE_SUCCESS), MessageType.success);
} else {
return new Message(WebContext.getI18nValue(ConstsOperateMessage.DELETE_ERROR), MessageType.error);
}
}
use of org.maxkey.entity.UserInfo in project MaxKey by dromara.
the class HistoryLogsAdapter method postHandle.
// after the handler is executed
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// 读取session中message
Message message = WebContext.getMessage();
if (message != null) {
if (message.getMessageScope() == MessageScope.DB || message.getMessageScope() == MessageScope.DB_CLIENT) {
// 判断message类型
// 取得当前用户信息
UserInfo userInfo = WebContext.getUserInfo();
// 创建日志记录
HistoryLogs historyLog = new HistoryLogs(message.getServiceName(), message.getCode(), message.getMessage(), JsonUtils.object2Json(message.getMessageObject()), message.getMessageType().toString(), message.getOperateType().toString(), userInfo == null ? null : userInfo.getId(), userInfo == null ? null : userInfo.getUsername(), "");
historyLog.setInstId(userInfo.getInstId());
_logger.debug("insert db logs content : " + historyLog);
// 日志插入数据库
historySystemLogsService.insert(historyLog);
if (message.getMessageScope() == MessageScope.DB) {
// message类型仅插入数据库
// 清除message
WebContext.clearMessage();
}
}
}
}
use of org.maxkey.entity.UserInfo in project MaxKey by dromara.
the class FeishuUsersService method buildUserInfo.
public UserInfo buildUserInfo(FeishuUsers user) {
UserInfo userInfo = new UserInfo();
// 账号
userInfo.setUsername(user.getUser_id());
// 名字
userInfo.setNickName(user.getNickname());
// 名字
userInfo.setDisplayName(user.getName());
// 手机
userInfo.setMobile(user.getMobile());
userInfo.setEmail(user.getEmail());
userInfo.setGender(user.getGender());
userInfo.setEmployeeNumber(user.getEmployee_no());
// 工作电话
userInfo.setWorkPhoneNumber(user.getMobile());
userInfo.setDepartmentId(user.getDepartment_ids()[0] + "");
// 职务
userInfo.setJobTitle(user.getJob_title());
// 工作地点
userInfo.setWorkAddressFormatted(user.getWork_station());
// 激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业。
if (user.getStatus().isIs_activated()) {
userInfo.setStatus(ConstsStatus.ACTIVE);
} else {
userInfo.setStatus(ConstsStatus.INACTIVE);
}
userInfo.setInstId(this.synchronizer.getInstId());
return userInfo;
}
Aggregations