MCPcopy Create free account
hub / github.com/apache/mesos / flags

Method flags

src/slave/http.cpp:924–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

922
923
924Future<Response> Http::flags(
925 const Request& request,
926 const Option<Principal>& principal) const
927{
928 // TODO(nfnt): Remove check for enabled
929 // authorization as part of MESOS-5346.
930 if (request.method != "GET" && slave->authorizer.isSome()) {
931 return MethodNotAllowed({"GET"}, request.method);
932 }
933
934 if (slave->authorizer.isNone()) {
935 return OK(_flags(), request.url.query.get("jsonp"));
936 }
937
938 authorization::Request authRequest;
939 authRequest.set_action(authorization::VIEW_FLAGS);
940
941 Option<authorization::Subject> subject = createSubject(principal);
942 if (subject.isSome()) {
943 authRequest.mutable_subject()->CopyFrom(subject.get());
944 }
945
946 return slave->authorizer.get()->authorized(authRequest)
947 .then(defer(
948 slave->self(),
949 [this, request](bool authorized) -> Future<Response> {
950 if (authorized) {
951 return OK(_flags(), request.url.query.get("jsonp"));
952 } else {
953 return Forbidden();
954 }
955 }));
956}
957
958
959JSON::Object Http::_flags() const

Callers 6

createGenericACLsMethod · 0.45
foreachFunction · 0.45
initializeMethod · 0.45
mountContainerFilesystemFunction · 0.45
prepareMountsFunction · 0.45
foreachFunction · 0.45

Calls 12

MethodNotAllowedClass · 0.85
OKClass · 0.85
createSubjectFunction · 0.85
deferFunction · 0.85
ForbiddenClass · 0.85
CopyFromMethod · 0.80
isSomeMethod · 0.45
isNoneMethod · 0.45
getMethod · 0.45
thenMethod · 0.45
authorizedMethod · 0.45
selfMethod · 0.45

Tested by

no test coverage detected