Alexander Rojas created MESOS-7489:
--------------------------------------

             Summary: Reduce code duplication when requesting an ObjectApprover
                 Key: MESOS-7489
                 URL: https://issues.apache.org/jira/browse/MESOS-7489
             Project: Mesos
          Issue Type: Improvement
          Components: agent, master, security
            Reporter: Alexander Rojas
            Priority: Minor


Every time the code needs to use an authorizer, the following snippet is used:

{code}
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(…)
{code}

This can be easily replace my a method:

{code}
Future<ObjectApprover> Master::approver(
  const Option<authorization::Subject> &subject,
  const authorization::Action &action)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to