|
@@ -90,14 +90,6 @@ public class CheckCurrenUserAspect {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
|
|
|
}
|
|
|
|
|
|
- //校验场景用户是否与当前登录用户相同,相同则跳出
|
|
|
- if(Objects.isNull(scenePro.getUserId())){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
- }
|
|
|
- if(scenePro.getUserId().equals(user.getId())){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
//如果上面场景用户与当前用户不匹配,需要校验当前用户是否拥有某些角色,从而可以访问此场景
|
|
|
List<UserRole> list = userRoleService.list(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, user.getId()));
|
|
|
Set<Long> roleIdSet = null;
|
|
@@ -121,57 +113,15 @@ public class CheckCurrenUserAspect {
|
|
|
|| Objects.isNull(sceneUser) || Objects.isNull(sceneUser.getCompanyId())
|
|
|
|| !currentUser.getCompanyId().equals(sceneUser.getCompanyId())){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
|
|
|
-// .getRequest();
|
|
|
-// // 读取session中的用户
|
|
|
-// SSOUser user = ssoLoginHelper.loginCheckV3(request.getHeader("token"));
|
|
|
-// String sceneNum = request.getParameter("sceneNum");
|
|
|
-//
|
|
|
-// ScenePro entity = sceneProService.findBySceneNum(sceneNum);
|
|
|
-// if(user == null){
|
|
|
-// log.info(getCheckUserMthodDescription(joinPoint));
|
|
|
-// log.info("不是当前用户的方法:"
|
|
|
-// + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()"));
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if("18750226207".equals(user.getUserName())){
|
|
|
-// log.info("18750226207该账号默认超级管理员,可以操作所有场景");
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(user.getId() == null){
|
|
|
-// Camera cameraEntity = cameraService.findByChildName(user.getUserName());
|
|
|
-// if((cameraEntity != null && entity != null) && (cameraEntity.getId().longValue() != entity.getCameraId().longValue())){
|
|
|
-// log.info(getCheckUserMthodDescription(joinPoint));
|
|
|
-// log.info("不是当前用户的方法:"
|
|
|
-// + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()"));
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// else if((user != null && entity != null) && entity.getUserId() != null && (user.getId().longValue() != entity.getUserId().longValue())){
|
|
|
-// SceneCooperation sceneCooperation = sceneCooperationService.getByNum(sceneNum);
|
|
|
-// if(Objects.nonNull(sceneCooperation)){
|
|
|
-// if(sceneCooperation.getUserId().longValue() != user.getId().longValue()){
|
|
|
-// log.info(getCheckUserMthodDescription(joinPoint));
|
|
|
-// log.info("不是当前用户的方法:"
|
|
|
-// + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()"));
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
-// }
|
|
|
-// }else {
|
|
|
-// log.info(getCheckUserMthodDescription(joinPoint));
|
|
|
-// log.info("不是当前用户的方法:"
|
|
|
-// + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()"));
|
|
|
-// throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
+ //校验场景用户是否与当前登录用户相同,相同则跳出
|
|
|
+ if(Objects.isNull(scenePro.getUserId()) || !scenePro.getUserId().equals(user.getId())){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5014);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|