|
@@ -323,18 +323,19 @@ public class MdePermissionServiceImpl implements MdePermissionService {
|
|
|
List<MdeRoleDO> roles = getEnableUserRoleListByUserIdFromCache(enterpriseId, userId);
|
|
|
// 如果角色为空,则只能查看自己
|
|
|
if (CollUtil.isEmpty(roles)) {
|
|
|
-// result.setSelf(f);
|
|
|
+ // 添加本身企业编号
|
|
|
+ CollUtil.addAll(result.getDataIds(), enterpriseUserBind
|
|
|
+ .getEnterpriseId());
|
|
|
if(enterpriseUserBindService.checkIsAdmin(enterpriseUserBind)) {
|
|
|
// 管理员 数据权限是 当前企业以及下级
|
|
|
CollUtil.addAll(result.getDataIds(), enterpriseService
|
|
|
.getChildEnterpriseIdListFromCache(enterpriseUserBind.getEnterpriseId()));
|
|
|
- // 添加本身企业编号
|
|
|
- CollUtil.addAll(result.getDataIds(), enterpriseUserBind
|
|
|
- .getEnterpriseId());
|
|
|
- }else{
|
|
|
- // 默认权限情况 共享企业数据
|
|
|
+ }else {
|
|
|
+ // 普通用户默认可以查看企业共享权限
|
|
|
+
|
|
|
CollectionUtils.addIfNotNull(result.getDataIds(), enterpriseUserBind.getEnterpriseId());
|
|
|
|
|
|
+// result.setSelf(true); //只能看自己的权限
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -350,20 +351,22 @@ public class MdePermissionServiceImpl implements MdePermissionService {
|
|
|
result.setAll(true);
|
|
|
continue;
|
|
|
}
|
|
|
- // 情况二,DEPT_CUSTOM 自定义
|
|
|
+ // 情况二,ENTERPRISE_CUSTOM 自定义
|
|
|
if (Objects.equals(role.getDataScope(), MdeDataScopeEnum.ENTERPRISE_CUSTOM.getScope())) {
|
|
|
CollUtil.addAll(result.getDataIds(), role.getDataScopeEnterpriseIds());
|
|
|
// 自定义可见企业时,保证可以看到自己所在的企业。否则,一些场景下可能会有问题。
|
|
|
// 例如说,登录时,基于 t_user 的 username 查询会可能被 dept_id 过滤掉
|
|
|
- CollUtil.addAll(result.getDataIds(), enterpriseUserBind.getEnterpriseId());
|
|
|
+ // 例如说,可以看到指定企业,但是不可见自己所在的企业,然后呢登录查询数据,肯定会查自己企业的数据的,这个时候被过滤掉就会有问题
|
|
|
+ // TODO 注释掉,因为目前逻辑没有对企业表数据进行控制,所以自定义不需要考虑加入自己企业的数据
|
|
|
+ // CollUtil.addAll(result.getDataIds(), enterpriseUserBind.getEnterpriseId());
|
|
|
continue;
|
|
|
}
|
|
|
- // 情况三,DEPT_ONLY 自己所在的数据权限
|
|
|
+ // 情况三,ENTERPRISE_ONLY 自己所在的数据权限
|
|
|
if (Objects.equals(role.getDataScope(), MdeDataScopeEnum.ENTERPRISE_ONLY.getScope())) {
|
|
|
CollectionUtils.addIfNotNull(result.getDataIds(), enterpriseUserBind.getEnterpriseId());
|
|
|
continue;
|
|
|
}
|
|
|
- // 情况四,DEPT_DEPT_AND_CHILD 自己所在及以下的数据权限
|
|
|
+ // 情况四,ENTERPRISE_AND_CHILD 自己所在及以下的数据权限
|
|
|
if (Objects.equals(role.getDataScope(), MdeDataScopeEnum.ENTERPRISE_AND_CHILD.getScope())) {
|
|
|
CollUtil.addAll(result.getDataIds(), enterpriseService
|
|
|
.getChildEnterpriseIdListFromCache(enterpriseUserBind.getEnterpriseId()));
|
|
@@ -374,12 +377,8 @@ public class MdePermissionServiceImpl implements MdePermissionService {
|
|
|
}
|
|
|
// 情况五,SELF
|
|
|
if (Objects.equals(role.getDataScope(), MdeDataScopeEnum.SELF.getScope())) {
|
|
|
- // if (!EnterpriseUserTypeEnum.ADMIN.getType()
|
|
|
- // .equals(enterpriseUserBind.getUserType())) {
|
|
|
- // // 不是管理员,加入自己的权限
|
|
|
- // result.setSelf(true);
|
|
|
- // }
|
|
|
- // 20240718 更改 所有用户都只能看到自己的数据
|
|
|
+ // 所有用户都只能看到当前自己企业的数据
|
|
|
+ CollUtil.addAll(result.getDataIds(), enterpriseUserBind.getEnterpriseId());
|
|
|
result.setSelf(true);
|
|
|
continue;
|
|
|
}
|