소스 검색

修改属性名

周浩 9 년 전
부모
커밋
118c6726f9

+ 9 - 9
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/role/RoleModule.java

@@ -33,7 +33,7 @@ public class RoleModule extends GenericPo<String> {
 
     private transient Module module;
 
-    private List<String> levels;
+    private List<String> actions;
 
 
     /**
@@ -98,21 +98,21 @@ public class RoleModule extends GenericPo<String> {
         this.module = module;
     }
 
-    public List<String> getLevels() {
+    public List<String> getActions() {
         if (!StringUtils.isNullOrEmpty(getO_level())) {
             try {
-                if (levels == null)
-                    levels = JSON.parseObject(getO_level(), new TypeReference<List<String>>(){});
+                if (actions == null)
+                    actions = JSON.parseObject(getO_level(), new TypeReference<List<String>>(){});
             } catch (Exception e) {
-                levels = new LinkedList<>();
+                actions = new LinkedList<>();
             }
         } else {
-            levels = new LinkedList<>();
+            actions = new LinkedList<>();
         }
-        return levels;
+        return actions;
     }
 
-    public void setLevels(List<String> levels) {
-        this.levels = levels;
+    public void setActions(List<String> actions) {
+        this.actions = actions;
     }
 }

+ 11 - 4
hsweb-web-bean/src/main/java/org/hsweb/web/bean/po/user/User.java

@@ -79,6 +79,13 @@ public class User extends GenericPo<String> {
         return null;
     }
 
+    public Module getModuleByUri(String uri) {
+        for (Module module : getModules()) {
+            if (uri.equals(module.getUri())) return module;
+        }
+        return null;
+    }
+
     public Set<Module> getModules() {
         if (roleInfo == null) initRoleInfo();
         return roleInfo.keySet();
@@ -128,11 +135,11 @@ public class User extends GenericPo<String> {
             for (RoleModule roleModule : roleModules) {
                 Module module = roleModule.getModule();
                 if (module == null || module.getStatus() != 1) continue;
-                Set<String> levels = roleInfo_tmp.get(module);
-                if (levels == null)
-                    roleInfo_tmp.put(module, new HashSet<>(roleModule.getLevels()));
+                Set<String> actions = roleInfo_tmp.get(module);
+                if (actions == null)
+                    roleInfo_tmp.put(module, new HashSet<>(roleModule.getActions()));
                 else {
-                    levels.addAll(roleModule.getLevels());
+                    actions.addAll(roleModule.getActions());
                 }
             }
         }