|
|
@@ -81,11 +81,12 @@ public class RoleServiceImpl extends SuperService {
|
|
|
Assert.hasText(param.getName(), "name不能为空");
|
|
|
Assert.hasText(param.getCode(), "code不能为空");
|
|
|
String oid = param.getOid();
|
|
|
- if (StringUtils.isEmpty(oid)) {
|
|
|
- oid = getCurrentOid();
|
|
|
- }
|
|
|
Assert.hasText(oid, "oid不能为空");
|
|
|
- param.setOid(oid);
|
|
|
+ Organization organization = organizationDao.findTopByOid(oid);
|
|
|
+ if (ObjectUtils.isEmpty(organization)) {
|
|
|
+ return ResultContent.buildFail(String.format("oid不存在:%s", oid));
|
|
|
+ }
|
|
|
+ param.setAuthType(organization.getAuthType());
|
|
|
if (param.getSort() == null) {
|
|
|
param.setSort(1L);
|
|
|
}
|
|
|
@@ -286,7 +287,7 @@ public class RoleServiceImpl extends SuperService {
|
|
|
});
|
|
|
}
|
|
|
// 角色确定
|
|
|
- AuthType authType = roleObj.getAuthType();
|
|
|
+ AuthType authType = organization.getAuthType();
|
|
|
return ResultContent.buildContent(buildAuthList(authType, postAuth));
|
|
|
}
|
|
|
|
|
|
@@ -370,7 +371,6 @@ public class RoleServiceImpl extends SuperService {
|
|
|
if (role == null) {
|
|
|
return ResultContent.buildFail("角色不存在");
|
|
|
}
|
|
|
-
|
|
|
var roleGroup = roleService.getRoleGroup(role.getRoleGroupId()).getContent();
|
|
|
com.github.microservice.auth.client.model.RoleModel roleModel;
|
|
|
if (roleGroup.getRoleId() == null || CollectionUtils.isEmpty(roleGroup.getRoleId())) {
|
|
|
@@ -408,12 +408,20 @@ public class RoleServiceImpl extends SuperService {
|
|
|
} else {
|
|
|
auth.removeAll(param.getAuths());
|
|
|
}
|
|
|
+ Organization organization = organizationDao.findTopByOid(role.getOid());
|
|
|
// 管理员角色默认有 管理员的权限
|
|
|
if (role.getIsAdmin() != null && role.getIsAdmin()) {
|
|
|
- auth.add(AuthConstant.Admin);
|
|
|
+ if (organization != null && organization.getAuthType() == AuthType.Platform) {
|
|
|
+ auth.add(AuthConstant.SuperAdmin);
|
|
|
+ } else {
|
|
|
+ auth.add(AuthConstant.Admin);
|
|
|
+ }
|
|
|
}
|
|
|
roleModel.setAuth(auth);
|
|
|
- roleService.updateRole(roleModel);
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<String> content = roleService.updateRole(roleModel);
|
|
|
+ if (content.getState() == ResultState.Fail) {
|
|
|
+ log.info("错误: {}", content.getMsg());
|
|
|
+ }
|
|
|
return ResultContent.buildSuccess(roleModel);
|
|
|
}
|
|
|
|