Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
Every time the code needs to use an authorizer, the following snippet is used:
Future<Owned<ObjectApprover>> somethingApprover; if (master->authorizer.isSome()) { Option<authorization::Subject> subject = createSubject(principal); somethingApprover = master->authorizer.get()->getObjectApprover( subject, authorization::VIEW_FRAMEWORK); } else { somethingApprover = Owned<ObjectApprover>(new AcceptingObjectApprover()); } return somethingApprover.then(…)
This can be easily replace my a method:
Future<ObjectApprover> Master::approver( const Option<authorization::Subject> &subject, const authorization::Action &action)