调整权限策略
This commit is contained in:
parent
aed3cdf4a9
commit
fffc4b9eab
@ -46,12 +46,20 @@ public class DataScopeHandler implements MultiDataPermissionHandler {
|
||||
if(table != null && CollectionUtils.isNotEmpty(table.getNameParts()) && !"1".equals(RedisCloudUtils.getRoleType())){
|
||||
String roleCode = RedisCloudUtils.getRoleCode();
|
||||
Class<?> mapperClazz = Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(".")));
|
||||
//优先检查是不是单角色权限
|
||||
DataScope dataScope = mapperClazz.getAnnotation(DataScope.class);
|
||||
if (ObjectUtils.isNotEmpty(dataScope) && dataScope.enabled()) {
|
||||
if(dataScope.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScope);
|
||||
}
|
||||
}
|
||||
//如果不是, 检查多角色权限
|
||||
DataScopes dataScopesList = mapperClazz.getAnnotation(DataScopes.class);
|
||||
if (ObjectUtils.isNotEmpty(dataScopesList)) {
|
||||
for (DataScope dataScope :dataScopesList.value()){
|
||||
if(dataScope.enabled()){
|
||||
if(dataScope.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScope);
|
||||
for (DataScope dataScopes :dataScopesList.value()){
|
||||
if(dataScopes.enabled()){
|
||||
if(dataScopes.permissionObject().equals(roleCode)){
|
||||
return buildDataScopeByAnnotation(dataScopes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user