【发布时间】:2018-04-04 20:30:24
【问题描述】:
我在我的Auth0 Delegated Administration Extension中使用了这个filter hook。
function(ctx, callback) {
// Get the company from the current user's metadata.
var company = ctx.request.user.app_metadata && ctx.request.user.app_metadata.company;
if (!company || !company.length) {
return callback(new Error('The current user is not part of any company.'));
}
// The GREEN company can see all users.
if (company === 'GREEN') {
return callback();
}
// Return the lucene query.
return callback(null, 'app_metadata.company:"' + company + '"');
}
当用户以GREEN 登录时,可以看到所有用户。但是当用户以RED登录时,看不到任何公司为RED的用户。
我需要在用户登录时进行此操作,用户应该只能访问其公司内的用户。 (GREEN公司的用户除外)。
但是上面的代码没有给出预期的结果。可能是什么问题?
【问题讨论】:
标签: lucene auth0 auth0-delegated-admin