| 1454 | |
| 1455 | |
| 1456 | Future<Try<JSON::Object, Master::Http::FlagsError>> Master::Http::_flags( |
| 1457 | const Option<Principal>& principal) const |
| 1458 | { |
| 1459 | if (master->authorizer.isNone()) { |
| 1460 | return __flags(); |
| 1461 | } |
| 1462 | |
| 1463 | authorization::Request authRequest; |
| 1464 | authRequest.set_action(authorization::VIEW_FLAGS); |
| 1465 | |
| 1466 | Option<authorization::Subject> subject = createSubject(principal); |
| 1467 | if (subject.isSome()) { |
| 1468 | authRequest.mutable_subject()->CopyFrom(subject.get()); |
| 1469 | } |
| 1470 | |
| 1471 | return master->authorizer.get()->authorized(authRequest) |
| 1472 | .then(defer( |
| 1473 | master->self(), |
| 1474 | [this](bool authorized) -> Future<Try<JSON::Object, FlagsError>> { |
| 1475 | if (authorized) { |
| 1476 | return __flags(); |
| 1477 | } else { |
| 1478 | return FlagsError(FlagsError::Type::UNAUTHORIZED); |
| 1479 | } |
| 1480 | })); |
| 1481 | } |
| 1482 | |
| 1483 | |
| 1484 | JSON::Object Master::Http::__flags() const |
nothing calls this directly
no test coverage detected