salix/loopback/server/boot/role-resolver.js

10 lines
346 B
JavaScript
Raw Normal View History

2024-09-06 08:40:16 +00:00
module.exports = async function(app) {
const models = app.models;
models.VnRole.registerResolver('$subordinate', async(role, ctx) => {
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
});
};