@avonjs/avonjs
Version:
A fluent Node.js API generator.
25 lines (24 loc) • 730 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (Parent) => {
class AuthorizedToSee extends Parent {
/**
* The callback used to authorize viewing the filter or action.
*/
seeCallback = () => true;
/**
* Determine if the filter or action should be available for the given request.
*/
authorizedToSee(request) {
return this.seeCallback(request);
}
/**
* Set the callback to be run to authorize viewing the filter or action.
*/
canSee(callback) {
this.seeCallback = callback;
return this;
}
}
return AuthorizedToSee;
};