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

Method authorizeGetWeight

src/master/weights_handler.cpp:348–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346
347
348Future<bool> Master::WeightsHandler::authorizeGetWeight(
349 const Option<Principal>& principal,
350 const WeightInfo& weight) const
351{
352 if (master->authorizer.isNone()) {
353 return true;
354 }
355
356 LOG(INFO) << "Authorizing principal '"
357 << (principal.isSome() ? stringify(principal.get()) : "ANY")
358 << "' to get weight for role '" << weight.role() << "'";
359
360 authorization::Request request;
361 request.set_action(authorization::VIEW_ROLE);
362
363 Option<authorization::Subject> subject = createSubject(principal);
364 if (subject.isSome()) {
365 request.mutable_subject()->CopyFrom(subject.get());
366 }
367
368 request.mutable_object()->mutable_weight_info()->CopyFrom(weight);
369 request.mutable_object()->set_value(weight.role());
370
371 return master->authorizer.get()->authorized(request);
372}
373
374} // namespace master {
375} // namespace internal {

Callers

nothing calls this directly

Calls 7

createSubjectFunction · 0.85
CopyFromMethod · 0.80
stringifyFunction · 0.50
isNoneMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
authorizedMethod · 0.45

Tested by

no test coverage detected