| 2546 | |
| 2547 | |
| 2548 | Future<Response> Master::Http::stateSummary( |
| 2549 | const Request& request, |
| 2550 | const Option<Principal>& principal) const |
| 2551 | { |
| 2552 | // TODO(greggomann): Remove this check once the `Principal` type is used in |
| 2553 | // `ReservationInfo`, `DiskInfo`, and within the master's `principals` map. |
| 2554 | // See MESOS-7202. |
| 2555 | if (principal.isSome() && principal->value.isNone()) { |
| 2556 | return Forbidden( |
| 2557 | "The request's authenticated principal contains claims, but no value " |
| 2558 | "string. The master currently requires that principals have a value"); |
| 2559 | } |
| 2560 | |
| 2561 | // When current master is not the leader, redirect to the leading master. |
| 2562 | if (!master->elected()) { |
| 2563 | return redirect(request); |
| 2564 | } |
| 2565 | |
| 2566 | return ObjectApprovers::create( |
| 2567 | master->authorizer, |
| 2568 | principal, |
| 2569 | {VIEW_ROLE, VIEW_FRAMEWORK}) |
| 2570 | .then(defer( |
| 2571 | master->self(), |
| 2572 | [this, request, principal](const Owned<ObjectApprovers>& approvers) { |
| 2573 | return deferBatchedRequest( |
| 2574 | &Master::ReadOnlyHandler::stateSummary, |
| 2575 | principal, |
| 2576 | ContentType::JSON, |
| 2577 | request.url.query, |
| 2578 | approvers); |
| 2579 | })); |
| 2580 | } |
| 2581 | |
| 2582 | |
| 2583 | string Master::Http::ROLES_HELP() |