From 4a47e4b93f62b5e636ac0e76f3e4ee98e2b83154 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期五, 02 八月 2024 08:32:55 +0800
Subject: [PATCH] 1、全局配置文件修改 2、工作流bpm功能修改

---
 iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java
index cdfe90c..c4e4ec1 100644
--- a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java
+++ b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/core/service/SecurityFrameworkServiceImpl.java
@@ -1,13 +1,7 @@
 package com.iailab.framework.security.core.service;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.ListUtil;
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.HashUtil;
-import cn.hutool.core.util.ObjectUtil;
 import com.iailab.framework.common.core.KeyValue;
-import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.framework.common.util.cache.CacheUtils;
 import com.iailab.framework.security.core.LoginUser;
 import com.iailab.framework.security.core.util.SecurityFrameworkUtils;
 import com.iailab.module.system.api.permission.PermissionApi;
@@ -70,7 +64,11 @@
     @Override
     @SneakyThrows
     public boolean hasAnyPermissions(String... permissions) {
-        return hasAnyPermissionsCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(permissions)));
+        Long userId = getLoginUserId();
+        if (userId == null) {
+            return false;
+        }
+        return hasAnyPermissionsCache.get(new KeyValue<>(userId, Arrays.asList(permissions)));
     }
 
     @Override
@@ -81,7 +79,11 @@
     @Override
     @SneakyThrows
     public boolean hasAnyRoles(String... roles) {
-        return hasAnyRolesCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(roles)));
+        Long userId = getLoginUserId();
+        if (userId == null) {
+            return false;
+        }
+        return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles)));
     }
 
     @Override

--
Gitblit v1.9.3