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 { formatMessage } from 'umi/locale';
|
||||||
import Authorized from '@/utils/Authorized';
|
import Authorized from '@/utils/Authorized';
|
||||||
import { menu } from '../defaultSettings';
|
import { menu } from '../defaultSettings';
|
||||||
import { getAdminUrls } from '../services/admin';
|
import { authorizationMenuResourceTree, authorizationResourcePermissions } from '../services/system';
|
||||||
import { authorizationMenuResourceTree } from '../services/system';
|
|
||||||
|
|
||||||
const { check } = Authorized;
|
const { check } = Authorized;
|
||||||
|
|
||||||
@ -213,7 +212,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
*getUrlsData(state, { put, call }) {
|
*getUrlsData(state, { put, call }) {
|
||||||
const { data } = yield call(getAdminUrls);
|
const { data } = yield call(authorizationResourcePermissions);
|
||||||
|
|
||||||
// 构建 {'/user': true} 这种 map 结构方便取数据、
|
// 构建 {'/user': true} 这种 map 结构方便取数据、
|
||||||
const urlsData = {};
|
const urlsData = {};
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
import { stringify } from '@/utils/request.qs';
|
import { stringify } from '@/utils/request.qs';
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// auth
|
|
||||||
|
|
||||||
export async function getAdminUrls(params) {
|
|
||||||
return request(`/admin-api/admins/admin/url_resource_list?${stringify(params)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// admin
|
// admin
|
||||||
|
|
||||||
export async function queryAdmin(params) {
|
export async function queryAdmin(params) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { stringify } from '@/utils/request.qs';
|
import {stringify} from '@/utils/request.qs';
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// ========== OAuth2 模块 ==========
|
// ========== OAuth2 模块 ==========
|
||||||
@ -14,6 +14,12 @@ export async function oauth2UsernameAuthenticate(params) {
|
|||||||
|
|
||||||
export async function authorizationMenuResourceTree() {
|
export async function authorizationMenuResourceTree() {
|
||||||
return request('/system-api/admins/authorization/menu-resource-tree', {
|
return request('/system-api/admins/authorization/menu-resource-tree', {
|
||||||
method: 'GET',
|
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);
|
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
|
@Autowired
|
||||||
private DeptmentService deptmentService;
|
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 ===========
|
// =========== 管理员管理 API ===========
|
||||||
//TODO 目前需要增加搜索所有子部门的用户
|
//TODO 目前需要增加搜索所有子部门的用户
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
Loading…
Reference in New Issue
Block a user