Ver código fonte

security uncomment

shjung 3 anos atrás
pai
commit
7d74af06f2

+ 1 - 0
src/main/java/com/its/op/security/WebSecurityConfig.java

@@ -57,6 +57,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/application/wall/**", "/wall/**").permitAll()
                 .antMatchers("/application/login/**").permitAll()
                 .antMatchers("/api/auth/**").permitAll()
+//                .antMatchers("/api/**").permitAll()
                 .anyRequest().authenticated()
                 .and()
             .formLogin()

+ 21 - 54
src/main/resources/static/application/op/00.main/main-header.js

@@ -10,6 +10,7 @@ const _menuDataAll = [
                 id: "0",
                 name: "통합모니터링",
                 icon: "/images/op/menu/010100.png",
+                always: true,
             },
             {
                 beginGroup: true,
@@ -707,9 +708,9 @@ $(() => {
             displayExpr: "name",
             submenuDirection: "auto",
             visible: true,
-            activeStateEnabled: true,
-            adaptivityEnabled: false,
-            orientation: "horizontal",
+            //activeStateEnabled: true,
+            //adaptivityEnabled: false,
+            //orientation: "horizontal",
             // itemTemplate(itemData, itemIndex, itemElement) {
             //     itemElement.css("padding-top", "6px");
             //     itemElement.css("padding-bottom", "6px");
@@ -751,20 +752,6 @@ $(() => {
                     handle.focus();
                 }
             },
-            // onSubmenuShowing: function (e) {
-            //     const items = e.component.option("dataSource");
-            //     //console.log(items);
-            //     const icon = items[0].items[0].icon;
-            //     //console.log(icon);
-            //     //if (icon == "check") DevExpress.ui.notify("Should be check", "success", 600);
-            //     //else items[0].items[0].icon = "check";
-
-            //     /* None of these methods to refresh the items are working */
-            //     //dxMenu.repaint();
-            //     //e.component.repaint();
-            //     //e.component.option("dataSource", items);
-            //     //e.component.option("items", items);
-            // },
         })
         .dxMenu("instance");
 });
@@ -782,9 +769,13 @@ function assignMenuAuth(menuMap) {
                     // SubMenu
                     menu.items.forEach((subMenu) => {
                         isAuth = menuMap.get(subMenu.page);
-                        if (!isAuth) {
+                        if (!isAuth && subMenu.always === true) {
                             enableMenu = false;
                             subMenu.enable = false;
+                            if (menu.always === true) {
+                                enableMenu = true;
+                                subMenu.enable = true;
+                            }
                         } else {
                             subMenu.enable = true;
                         }
@@ -793,12 +784,15 @@ function assignMenuAuth(menuMap) {
                     isAuth = menuMap.get(menu.page);
                     if (!isAuth) {
                         enableMenu = false;
+                        if (menu.always === true) {
+                            enableMenu = true;
+                        }
                     }
                 }
                 menu.enable = enableMenu;
             });
         }
-        if (group.id === 1) {
+        if (group.always === true) {
             enableGroup = true;
         }
         group.enable = enableGroup;
@@ -809,53 +803,26 @@ function assignMenuAuth(menuMap) {
         if (group.enable === false) {
             return;
         }
-        const groupMenu = {
-            id: group.id,
-            name: group.name,
-            icon: group.icon,
-            items: [],
-        };
-        if (group.id === 1) {
-            const trafficMenu = {
-                id: "0",
-                name: "통합모니터링",
-                icon: "/images/op/menu/010100.png",
-            };
-            groupMenu.items.push(trafficMenu);
-        }
-        _menuData.push(groupMenu);
-        //"undefined";
 
+        let groupMenu = JSON.parse(JSON.stringify(group));
+        groupMenu.items = [];
         if (group.items) {
             group.items.forEach((menu) => {
                 if (menu.enable === false) {
                     return;
                 }
+                let firstMenu = JSON.parse(JSON.stringify(menu));
                 if (menu.items) {
-                    // SubMenu
+                    firstMenu.items = [];
                     menu.items.forEach((subMenu) => {
-                        isAuth = menuMap.get(subMenu.page);
-                        if (!isAuth) {
-                            enableMenu = false;
-                            subMenu.enable = false;
-                        } else {
-                            subMenu.enable = true;
+                        if (subMenu.enable) {
+                            firstMenu.items.push(subMenu);
                         }
                     });
-                } else {
-                  let firstMenus = menu.items
-                    let firstMenu = {
-                        beginGroup: menu.beginGroup === "undefined" ? false : menu.beginGroup,
-                        id: menu.id,
-                        name: menu.name,
-                        page: menu.page,
-                        option: menu.option,
-                        icon: menu.icon,
-                    };
-                    groupMenu.items.push(firstMenu);
                 }
+                groupMenu.items.push(firstMenu);
             });
         }
+        _menuData.push(groupMenu);
     });
-    console.log(_menuData);
 }