v2.9.0 GA & optimize

v2.9.0 GA & optimize
This commit is contained in:
MaxKey
2021-08-21 20:39:12 +08:00
parent 225b32e36b
commit 1fc03fc3b2
11 changed files with 64 additions and 73 deletions

View File

@@ -150,8 +150,8 @@ public class MaxKeyMvcConfig implements WebMvcConfigurer {
.addPathPatterns("/profile/**")
.addPathPatterns("/safe/**")
.addPathPatterns("/historys/**")
.addPathPatterns("/loginsession/**")
.addPathPatterns("loginsession/loginSessionList/grid")
.addPathPatterns("/session/**")
.addPathPatterns("/session/**/**")
.addPathPatterns("/appList")
.addPathPatterns("/appList/**")
.addPathPatterns("/socialsignon/**")

View File

@@ -83,7 +83,7 @@ public class SafeController {
if(newPassword ==null ||newPassword.equals("")) {
}else if(userInfoService.changePassword(oldPassword,newPassword,confirmPassword,ConstantsPasswordSetType.PASSWORD_NORMAL)){
WebContext.getSession().setAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE,ConstantsPasswordSetType.PASSWORD_NORMAL);
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,ConstantsPasswordSetType.PASSWORD_NORMAL);
return WebContext.redirect("/index");
}
@@ -104,7 +104,7 @@ public class SafeController {
if(newPassword ==null ||newPassword.equals("")) {
}else if(userInfoService.changePassword(oldPassword,newPassword,confirmPassword,ConstantsPasswordSetType.PASSWORD_NORMAL)){
WebContext.getSession().setAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE,ConstantsPasswordSetType.PASSWORD_NORMAL);
WebContext.getSession().setAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE,ConstantsPasswordSetType.PASSWORD_NORMAL);
return WebContext.redirect("/index");
}

View File

@@ -20,21 +20,16 @@ package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authn.online.OnlineTicket;
import org.maxkey.authn.online.OnlineTicketServices;
import org.maxkey.constants.ConstantsOperateMessage;
import org.maxkey.entity.HistoryLogin;
import org.maxkey.entity.HistoryLoginApps;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.entity.UserInfo;
import org.maxkey.persistence.db.LoginHistoryService;
import org.maxkey.persistence.db.LoginService;
import org.maxkey.persistence.service.HistoryLoginAppsService;
import org.maxkey.persistence.service.HistoryLoginService;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.DateUtils;
import org.maxkey.util.StringUtils;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
import org.maxkey.web.message.Message;
import org.maxkey.web.message.MessageType;
@@ -42,7 +37,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
@@ -59,7 +53,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/
@Controller
@RequestMapping(value = { "/loginsession" })
@RequestMapping(value = { "/session" })
public class LoginSessionController {
static final Logger _logger = LoggerFactory.getLogger(LoginSessionController.class);
@@ -74,9 +68,9 @@ public class LoginSessionController {
@Autowired
OnlineTicketServices onlineTicketServices;
@RequestMapping(value = { "/loginSessionList" })
@RequestMapping(value = { "/sessionList" })
public String authList() {
return "historys/loginSessionList";
return "historys/sessionList";
}
/**
@@ -85,10 +79,10 @@ public class LoginSessionController {
* @param logsAuth
* @return
*/
@RequestMapping(value = { "/loginSessionList/grid" })
@RequestMapping(value = { "/sessionList/grid" })
@ResponseBody
public JpaPageResults<HistoryLogin> loginSessionListGrid(@ModelAttribute("historyLogin") HistoryLogin historyLogin) {
_logger.debug("history/loginsession/ loginSessionListGrid() " + historyLogin);
_logger.debug("history/session/ sessionListGrid() " + historyLogin);
historyLogin.setUserId(WebContext.getUserInfo().getId());
return historyLoginService.queryOnlineSession(historyLogin);
}
@@ -101,17 +95,13 @@ public class LoginSessionController {
_logger.debug(ids);
boolean isTerminated = false;
try {
OnlineTicket onlineTicket = null;
Authentication authentication = WebContext.getAuthentication();
if(authentication.getPrincipal() instanceof SigninPrincipal) {
SigninPrincipal signinPrincipal = (SigninPrincipal)authentication.getPrincipal();
//onlineTicket
onlineTicket = signinPrincipal.getOnlineTicket();
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(onlineTicket.getTicketId().contains(sessionId)) {
if(currentUserSessionId.contains(sessionId)) {
//skip current session
continue;
}

View File

@@ -80,7 +80,7 @@ public class PermissionAdapter implements AsyncHandlerInterceptor {
throws Exception {
_logger.trace("PermissionAdapter preHandle");
_logger.trace("PermissionAdapter " + request.getSession().getId());
Object passwordSetTypeAttribute=WebContext.getSession().getAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE);
Object passwordSetTypeAttribute=WebContext.getSession().getAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE);
if(passwordSetTypeAttribute != null) {
Integer passwordSetType=(Integer)passwordSetTypeAttribute;

View File

@@ -25,7 +25,7 @@
<div id="tool_box_right">
<input id="deleteBtn" type="button" class="button btn btn-danger mr-3 "
value="<@locale code="button.text.terminate"/>"
wurl="<@base/>/loginsession/terminate" />
wurl="<@base/>/session/terminate" />
</div>
</td>
</tr>
@@ -53,7 +53,7 @@
<div class="mainwrap" id="main">
<table data-url="<@base />/loginsession/loginSessionList/grid"
<table data-url="<@base />/session/sessionList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"

View File

@@ -55,24 +55,24 @@
<ul>
<!--登录日志-->
<li id="nav_second_1501" class="nav_second_level">
<a href="<@base/>/loginsession/loginSessionList"><@locale code="navs.audit.loginsession"/></a>
<a href="<@base/>/session/sessionList"><@locale code="navs.audit.loginsession"/></a>
</li>
</ul>
<ul>
<!--登录日志-->
<li id="nav_second_1501" class="nav_second_level">
<li id="nav_second_1502" class="nav_second_level">
<a href="<@base/>/historys/loginList"><@locale code="navs.audit.login"/></a>
</li>
</ul>
<ul>
<!--访问日志-->
<li id="nav_second_1502" class="nav_second_level">
<li id="nav_second_1503" class="nav_second_level">
<a href="<@base/>/historys/loginAppsList"><@locale code="navs.audit.signon"/></a>
</li>
</ul>
<ul>
<!--操作日志-->
<li id="nav_second_1503" class="nav_second_level">
<li id="nav_second_1504" class="nav_second_level">
<a href="<@base/>/historys/systemLogsList"><@locale code="navs.audit.operation"/></a>
</li>
</ul>