사이트맵 권한 있는 메뉴만 나오도록
eapim-admin CI / build (push) Has been cancelled

This commit is contained in:
eastargh
2026-07-31 13:27:14 +09:00
parent 5fe247df65
commit fc6b96d7cd
5 changed files with 18 additions and 9 deletions
+2 -2
View File
@@ -566,8 +566,8 @@
</h1><!-- /monitoring/images/top_logo.png -->
<div class="topmenu_box">
<ul>
<li style="width:240px;" id="newDashboardShow">
<a style="width:240px;"
<li style="width:240px;">
<a style="width:240px; cursor: default"
href="#"><span><%=SessionManager.getUserName(request) %>(<%=SessionManager.getUserId(request) %>-<%=System.getProperty("inst.Name") %>)</span>
<span onClick="javascript:openColorPopup();"><%=localeMessage.getString("screen.customer") %></span>
<% if (!"".equals(LastLoginYms.trim())) { %>
@@ -1,5 +1,9 @@
package com.eactive.eai.rms.common.acl.sitemap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -7,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.eactive.eai.rms.common.base.BaseAnnotationController;
import com.eactive.eai.rms.common.login.SessionManager;
@Controller
@RequiredArgsConstructor
@@ -15,8 +20,10 @@ public class SitemapController extends BaseAnnotationController {
private final SitemapService sitemapService;
@GetMapping(value = "/common/acl/sitemap/sitemapMan.view")
public String view(@RequestParam(value = "serviceType", required = false) String serviceType, Model model) {
model.addAttribute("sitemapTree", sitemapService.getSitemapTree(serviceType));
public String view(@RequestParam(value = "serviceType", required = false) String serviceType,
HttpServletRequest request, Model model) {
List<String> roleIds = SessionManager.getRoleId(request);
model.addAttribute("sitemapTree", sitemapService.getSitemapTree(roleIds, serviceType));
return "/common/acl/sitemap/sitemapMan";
}
@@ -6,6 +6,6 @@ import com.eactive.eai.rms.common.acl.sitemap.ui.SitemapNode;
public interface SitemapService {
public List<SitemapNode> getSitemapTree(String serviceType);
public List<SitemapNode> getSitemapTree(List<String> roleIds, String serviceType);
}
@@ -28,7 +28,7 @@ public class SitemapServiceImpl extends BaseService implements SitemapService {
@Autowired
private RoleMenuAuthService roleMenuAuthService;
public List<SitemapNode> getSitemapTree(String serviceType) {
public List<SitemapNode> getSitemapTree(List<String> roleIds, String serviceType) {
Menu root = menuService.getById("ROOT_DEV");
Menu langRoot = findLangRoot(root);
List<SitemapNode> tree = new ArrayList<>();
@@ -38,7 +38,7 @@ public class SitemapServiceImpl extends BaseService implements SitemapService {
Set<String> serviceTypeMenuIds = StringUtils.isBlank(serviceType)
? null
: new HashSet<>(roleMenuAuthService.findMenuIdsByServiceType(serviceType));
: new HashSet<>(roleMenuAuthService.findMenuIdsByRoleIdsAndServiceType(roleIds, serviceType));
for (Menu menu : sortedChildren(langRoot)) {
if (isVisible(menu) && matchesServiceType(menu, serviceTypeMenuIds)) {
@@ -51,7 +51,7 @@ public class RoleMenuAuthService extends AbstractEMSDataSerivce<RoleMenuAuth, Ro
.fetch();
}
public List<String> findMenuIdsByServiceType(String serviceType) {
public List<String> findMenuIdsByRoleIdsAndServiceType(List<String> roleIds, String serviceType) {
QRoleMenuAuth qRoleMenuAuth = QRoleMenuAuth.roleMenuAuth;
@@ -59,7 +59,9 @@ public class RoleMenuAuthService extends AbstractEMSDataSerivce<RoleMenuAuth, Ro
.select(qRoleMenuAuth.id.menuId)
.distinct()
.from(qRoleMenuAuth)
.where(qRoleMenuAuth.id.serviceType.eq(serviceType))
.where(qRoleMenuAuth.id.roleId.in(roleIds),
qRoleMenuAuth.auth.in("R", "W"),
qRoleMenuAuth.id.serviceType.eq(serviceType))
.setHint(QueryHints.CACHEABLE, true)
.fetch();
}