Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to return a promise from the whitelist function #26

Open
KieronWiltshire opened this issue Jun 21, 2016 · 1 comment
Open

Comments

@KieronWiltshire
Copy link

KieronWiltshire commented Jun 21, 2016

The whitelist feature is great, however my function need to be able to return a Promise, something like the example below :/

whitelist: function(request) {
    return new Promise(function(resolve, reject) {
        if (request.context && request.context.user) {
             api.user.permitsAuthorizationPolicy({user: request.context.user, policy: '*'}).then(resolve).catch(function(error) {
                 reject();
             }
        } else {
             reject();
        }
    });
}

Right now, without this support, I have middleware which is checking the policy, and saving it to the request object, then checking that boolean value within the whitelist function. It's tedious imo

Will you allow this functionality please as I'm sure others would want it too!

@KieronWiltshire
Copy link
Author

Doesn't look like anyone maintains this package... Look at all the open isses...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant