Skip to content

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

@KieronWiltshire

Description

@KieronWiltshire

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions