mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: custom request server-side permission validation error
This commit is contained in:
parent
97940d246c
commit
bcbffbc8b2
@ -77,13 +77,12 @@ export async function send(this: CustomRequestPlugin, ctx: Context, next: Next)
|
|||||||
|
|
||||||
// root role has all permissions
|
// root role has all permissions
|
||||||
if (ctx.state.currentRole !== 'root') {
|
if (ctx.state.currentRole !== 'root') {
|
||||||
const crRepo = ctx.db.getRepository('customRequestsRoles');
|
const crRepo = ctx.db.getRepository('uiButtonSchemasRoles');
|
||||||
const hasRoles = await crRepo.find({
|
const hasRoles = await crRepo.find({
|
||||||
filter: {
|
filter: {
|
||||||
customRequestKey: filterByTk,
|
uid: filterByTk,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hasRoles.length) {
|
if (hasRoles.length) {
|
||||||
if (!hasRoles.find((item) => item.roleName === ctx.state.currentRole)) {
|
if (!hasRoles.find((item) => item.roleName === ctx.state.currentRole)) {
|
||||||
return ctx.throw(403, 'custom request no permission');
|
return ctx.throw(403, 'custom request no permission');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user