Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-7489

Reduce code duplication when requesting an ObjectApprover

    XMLWordPrintableJSON

Details

    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)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            arojas Alexander Rojas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: