fix: isCurrentUser context params
This commit is contained in:
parent
b9f3acf05d
commit
1f82a97eb9
@ -593,12 +593,6 @@ export class PluginACL extends Plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
const collection = ctx.db.getCollection(resourceName);
|
||||
|
||||
if (!collection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.status !== 200) {
|
||||
return;
|
||||
}
|
||||
@ -607,6 +601,12 @@ export class PluginACL extends Plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
const collection = ctx.db.getCollection(resourceName);
|
||||
|
||||
if (!collection) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Model = collection.model;
|
||||
|
||||
const primaryKeyField = Model.primaryKeyField || Model.primaryKeyAttribute;
|
||||
@ -667,6 +667,7 @@ export class PluginACL extends Plugin {
|
||||
actionCtx.permission?.can === null && !actionCtx.permission.skip
|
||||
? null
|
||||
: actionCtx.permission?.parsedParams || {},
|
||||
actionCtx,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -676,7 +677,7 @@ export class PluginACL extends Plugin {
|
||||
|
||||
const allAllowed = [];
|
||||
|
||||
for (const [action, params] of actionsParams) {
|
||||
for (const [action, params, actionCtx] of actionsParams) {
|
||||
if (!params) {
|
||||
continue;
|
||||
}
|
||||
@ -686,7 +687,10 @@ export class PluginACL extends Plugin {
|
||||
continue;
|
||||
}
|
||||
|
||||
const queryParams = collection.repository.buildQueryOptions(params);
|
||||
const queryParams = collection.repository.buildQueryOptions({
|
||||
...params,
|
||||
context: actionCtx,
|
||||
});
|
||||
|
||||
const actionSql = ctx.db.sequelize.queryInterface.queryGenerator.selectQuery(
|
||||
Model.getTableName(),
|
||||
|
Loading…
Reference in New Issue
Block a user