| 1221 | |
| 1222 | |
| 1223 | Future<Response> Master::Http::frameworks( |
| 1224 | const Request& request, |
| 1225 | const Option<Principal>& principal) const |
| 1226 | { |
| 1227 | // TODO(greggomann): Remove this check once the `Principal` type is used in |
| 1228 | // `ReservationInfo`, `DiskInfo`, and within the master's `principals` map. |
| 1229 | // See MESOS-7202. |
| 1230 | if (principal.isSome() && principal->value.isNone()) { |
| 1231 | return Forbidden( |
| 1232 | "The request's authenticated principal contains claims, but no value " |
| 1233 | "string. The master currently requires that principals have a value"); |
| 1234 | } |
| 1235 | |
| 1236 | // When current master is not the leader, redirect to the leading master. |
| 1237 | if (!master->elected()) { |
| 1238 | return redirect(request); |
| 1239 | } |
| 1240 | |
| 1241 | return ObjectApprovers::create( |
| 1242 | master->authorizer, |
| 1243 | principal, |
| 1244 | {VIEW_FRAMEWORK, VIEW_TASK, VIEW_EXECUTOR}) |
| 1245 | .then(defer( |
| 1246 | master->self(), |
| 1247 | [this, request, principal](const Owned<ObjectApprovers>& approvers) { |
| 1248 | return deferBatchedRequest( |
| 1249 | &Master::ReadOnlyHandler::frameworks, |
| 1250 | principal, |
| 1251 | ContentType::JSON, |
| 1252 | request.url.query, |
| 1253 | approvers); |
| 1254 | })); |
| 1255 | } |
| 1256 | |
| 1257 | |
| 1258 | mesos::master::Response::GetFrameworks::Framework model( |