|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.byzs.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.byzs.module.system.controller.admin.permission.vo.permission.*;
|
|
|
import cn.iocoder.byzs.module.system.service.permission.PermissionService;
|
|
|
+import cn.iocoder.byzs.module.system.service.permission.RoleService;
|
|
|
import cn.iocoder.byzs.module.system.service.tenant.TenantService;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
@@ -32,6 +33,8 @@ public class PermissionController {
|
|
|
private PermissionService permissionService;
|
|
|
@Resource
|
|
|
private TenantService tenantService;
|
|
|
+ @Resource
|
|
|
+ private RoleService roleService;
|
|
|
|
|
|
@Operation(summary = "获得角色拥有的菜单编号")
|
|
|
@Parameter(name = "roleId", description = "角色编号", required = true)
|
|
|
@@ -58,6 +61,8 @@ public class PermissionController {
|
|
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-data-scope')")
|
|
|
public CommonResult<Boolean> assignRoleDataScope(@Valid @RequestBody PermissionAssignRoleDataScopeReqVO reqVO) {
|
|
|
permissionService.assignRoleDataScope(reqVO.getRoleId(), reqVO.getDataScope(), reqVO.getDataScopeDeptIds());
|
|
|
+ // 更新角色缓存
|
|
|
+// roleService.getRoleFromCache(reqVO.getRoleId());
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
@@ -66,6 +71,8 @@ public class PermissionController {
|
|
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-data-scope')")//后续改成course单独权限,目前没办法测试并更改租户默认管理员的权限
|
|
|
public CommonResult<Boolean> assignRoleCourseScope(@Valid @RequestBody PermissionAssignRoleCourseScopeReqVO reqVO) {
|
|
|
permissionService.assignRoleCourseScope(reqVO.getRoleId(), reqVO.getDataScopeCourseIds());
|
|
|
+ // 更新角色缓存
|
|
|
+// roleService.getRoleFromCache(reqVO.getRoleId());
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
@@ -75,6 +82,8 @@ public class PermissionController {
|
|
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-data-scope')")//后续改成blockly单独权限,目前没办法测试并更改租户默认管理员的权限
|
|
|
public CommonResult<Boolean> assignRoleBlocklyScope(@Valid @RequestBody PermissionAssignRoleBlocklyScopeReqVO reqVO) {
|
|
|
permissionService.assignRoleBlocklyScope(reqVO.getRoleId(), reqVO.getDataScopeBlocklyIds());
|
|
|
+ // 更新角色缓存
|
|
|
+// roleService.getRoleFromCache(reqVO.getRoleId());
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
@@ -90,7 +99,10 @@ public class PermissionController {
|
|
|
@PostMapping("/assign-user-role")
|
|
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-user-role')")
|
|
|
public CommonResult<Boolean> assignUserRole(@Validated @RequestBody PermissionAssignUserRoleReqVO reqVO) {
|
|
|
+ // 清除角色缓存
|
|
|
permissionService.assignUserRole(reqVO.getUserId(), reqVO.getRoleIds());
|
|
|
+ // 刷新用户角色缓存
|
|
|
+ permissionService.getUserRoleIdListByUserIdFromCache(reqVO.getUserId());
|
|
|
return success(true);
|
|
|
}
|
|
|
|