2024-09-06 08:40:16 +00:00
|
|
|
module.exports = async function(app) {
|
|
|
|
const models = app.models;
|
|
|
|
|
|
|
|
models.VnRole.registerResolver('$subordinate', async(role, ctx) => {
|
2024-09-18 10:19:49 +00:00
|
|
|
if (!ctx.accessToken) return false;
|
|
|
|
const httpCtx = {req: {accessToken: {userId: ctx.accessToken.userId}}};
|
|
|
|
return models.Worker.isSubordinate(httpCtx, +ctx.modelId);
|
2024-09-06 08:40:16 +00:00
|
|
|
});
|
|
|
|
};
|