1. admin-web 接入管理员资源集合
2. system 迁移管理员资源接口
This commit is contained in:
parent
983c01d709
commit
caf605063c
@ -3,8 +3,7 @@ import isEqual from 'lodash/isEqual';
|
||||
import { formatMessage } from 'umi/locale';
|
||||
import Authorized from '@/utils/Authorized';
|
||||
import { menu } from '../defaultSettings';
|
||||
import { getAdminUrls } from '../services/admin';
|
||||
import { authorizationMenuResourceTree } from '../services/system';
|
||||
import { authorizationMenuResourceTree, authorizationResourcePermissions } from '../services/system';
|
||||
|
||||
const { check } = Authorized;
|
||||
|
||||
@ -213,7 +212,7 @@ export default {
|
||||
});
|
||||
},
|
||||
*getUrlsData(state, { put, call }) {
|
||||
const { data } = yield call(getAdminUrls);
|
||||
const { data } = yield call(authorizationResourcePermissions);
|
||||
|
||||
// 构建 {'/user': true} 这种 map 结构方便取数据、
|
||||
const urlsData = {};
|
||||
|
@ -1,12 +1,6 @@
|
||||
import { stringify } from '@/utils/request.qs';
|
||||
import request from '@/utils/request';
|
||||
|
||||
// auth
|
||||
|
||||
export async function getAdminUrls(params) {
|
||||
return request(`/admin-api/admins/admin/url_resource_list?${stringify(params)}`);
|
||||
}
|
||||
|
||||
// admin
|
||||
|
||||
export async function queryAdmin(params) {
|
||||
|
@ -17,3 +17,9 @@ export async function authorizationMenuResourceTree() {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
export async function authorizationResourcePermissions(params) {
|
||||
return request(`/system-api/admins/authorization/resource-permissions`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
@ -63,4 +63,12 @@ public class AdminsAuthorizationController {
|
||||
return CommonResult.success(rootNodes);
|
||||
}
|
||||
|
||||
@GetMapping("/resource-permissions")
|
||||
@ApiOperation(value = "获得当前账号的资源权限列表")
|
||||
public CommonResult<Set<String>> resourcePermissions() {
|
||||
List<ResourceBO> resources = authorizationService.getResourcesByAccountId(new AuthorizationGetResourcesByAccountIdDTO()
|
||||
.setAccountId(AdminSecurityContextHolder.getAccountId()));
|
||||
return CommonResult.success(resources.stream().map(ResourceBO::getRoute).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,17 +50,6 @@ public class AdminController {
|
||||
@Autowired
|
||||
private DeptmentService deptmentService;
|
||||
|
||||
// =========== 当前管理员相关的资源 API ===========
|
||||
|
||||
// TODO 功能:当前管理员
|
||||
|
||||
@GetMapping("/url_resource_list")
|
||||
@ApiOperation(value = "获得当前登陆的管理员拥有的 URL 权限列表")
|
||||
public CommonResult<Set<String>> urlResourceList() {
|
||||
List<ResourceBO> resources = resourceService.getResourcesByTypeAndRoleIds(ResourceConstants.TYPE_BUTTON, AdminSecurityContextHolder.getContext().getRoleIds());
|
||||
return success(resources.stream().map(ResourceBO::getHandler).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
// =========== 管理员管理 API ===========
|
||||
//TODO 目前需要增加搜索所有子部门的用户
|
||||
@GetMapping("/page")
|
||||
|
Loading…
Reference in New Issue
Block a user