|
@@ -3,12 +3,15 @@ package com.ozs.framework.web.service;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import com.ozs.common.core.domain.entity.SysRole;
|
|
|
import com.ozs.common.core.domain.entity.SysUser;
|
|
|
import com.ozs.system.service.ISysMenuService;
|
|
|
import com.ozs.system.service.ISysRoleService;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
/**
|
|
|
* 用户权限处理
|
|
@@ -63,13 +66,16 @@ public class SysPermissionService
|
|
|
{
|
|
|
List<SysRole> roles = user.getRoles();
|
|
|
if (!roles.isEmpty() && roles.size() > 1)
|
|
|
- {
|
|
|
- // 多角色设置permissions属性,以便数据权限匹配权限
|
|
|
- for (SysRole role : roles)
|
|
|
- {
|
|
|
- Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
|
|
- role.setPermissions(rolePerms);
|
|
|
- perms.addAll(rolePerms);
|
|
|
+ {
|
|
|
+ if (!ObjectUtils.isEmpty(roles.stream().filter(r-> "admin".equals(r.getRoleKey())).collect(Collectors.toList()))){
|
|
|
+ perms.add("*:*:*");
|
|
|
+ }else {
|
|
|
+ // 多角色设置permissions属性,以便数据权限匹配权限
|
|
|
+ for (SysRole role : roles) {
|
|
|
+ Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
|
|
+ role.setPermissions(rolePerms);
|
|
|
+ perms.addAll(rolePerms);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|