Kaynağa Gözat

协作场景权限校验

dengsixing 3 yıl önce
ebeveyn
işleme
6d3c4bf2e7

+ 4 - 4
4dkankan-center-scene/src/main/java/com/fdkankan/scene/Interceptor/CheckCooperationPermitAspect.java

@@ -28,7 +28,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 @Log4j2
 @Aspect
 @Component
-@Order(2)
+@Order(101)
 public class CheckCooperationPermitAspect {
 
 	@Autowired
@@ -68,11 +68,11 @@ public class CheckCooperationPermitAspect {
         }
 
         //如果不是用户自己的场景,判断是否有协作权限
-        String username = redisUtil.hget(RedisKey.SCENE_COOPERATION_NUM_USERNAME, num);
-        if(StrUtil.isEmpty(username)){
+        String userId = redisUtil.hget(RedisKey.SCENE_COOPERATION_NUM_USERNAME, num);
+        if(StrUtil.isEmpty(userId)){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
         }
-        if(!username.equals(user.getUserName())){
+        if(!userId.equals(String.valueOf(user.getId()))){
             throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
         }
 	}

+ 1 - 1
4dkankan-common/src/main/java/com/fdkankan/common/util/WebUtil.java

@@ -30,7 +30,7 @@ public class WebUtil {
         String contentType = request.getContentType();
         if(ContentType.JSON.getValue().equals(contentType)){
             HashMap hashMap = JSON.parseObject(JSON.toJSONString(args[0]), HashMap.class);
-            hashMap.get("num");
+            return (String) hashMap.get("num");
         }
         return request.getParameter("num");
     }