@@ -24,4 +24,9 @@ public interface PermissionApi extends PermissionCommonApi {
|
||||
@Parameter(name = "roleIds", description = "角色编号集合", example = "1,2", required = true)
|
||||
CommonResult<Set<Long>> getUserRoleIdListByRoleIds(@RequestParam("roleIds") Collection<Long> roleIds);
|
||||
|
||||
@GetMapping(PREFIX + "/user-role-id-list-by-user-id")
|
||||
@Operation(summary = "获得用户拥有的角色编号集合")
|
||||
@Parameter(name = "userId", description = "用户编号", example = "1", required = true)
|
||||
CommonResult<Set<Long>> getUserRoleIdListByUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
}
|
||||
@@ -22,4 +22,9 @@ public interface RoleApi {
|
||||
@Parameter(name = "ids", description = "角色编号数组", example = "1,2", required = true)
|
||||
CommonResult<Boolean> validRoleList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/has-any-super-admin")
|
||||
@Operation(summary = "判断角色列表中是否有超级管理员")
|
||||
@Parameter(name = "roleIds", description = "角色编号集合", example = "1,2", required = true)
|
||||
CommonResult<Boolean> hasAnySuperAdmin(@RequestParam("roleIds") Collection<Long> roleIds);
|
||||
|
||||
}
|
||||
@@ -26,6 +26,11 @@ public class PermissionApiImpl implements PermissionApi {
|
||||
return success(permissionService.getUserRoleIdListByRoleId(roleIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Set<Long>> getUserRoleIdListByUserId(Long userId) {
|
||||
return success(permissionService.getUserRoleIdListByUserIdFromCache(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> hasAnyPermissions(Long userId, String... permissions) {
|
||||
return success(permissionService.hasAnyPermissions(userId, permissions));
|
||||
|
||||
@@ -22,4 +22,9 @@ public class RoleApiImpl implements RoleApi {
|
||||
roleService.validateRoleList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> hasAnySuperAdmin(Collection<Long> roleIds) {
|
||||
return success(roleService.hasAnySuperAdmin(roleIds));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user