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

Method create

src/common/http.cpp:1204–1237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1202
1203
1204Future<Owned<ObjectApprovers>> ObjectApprovers::create(
1205 const Option<Authorizer*>& authorizer,
1206 const Option<Principal>& principal,
1207 std::initializer_list<authorization::Action> actions)
1208{
1209 // Ensures there are no repeated elements.
1210 // Note: `set` is necessary because we relay in the order of the elements
1211 // while doing `zip` below.
1212 set<authorization::Action> _actions(actions);
1213
1214 Option<authorization::Subject> subject =
1215 authorization::createSubject(principal);
1216
1217 if (authorizer.isNone()) {
1218 hashmap<authorization::Action, shared_ptr<const ObjectApprover>> approvers;
1219
1220 foreach (authorization::Action action, _actions) {
1221 approvers.put(action, std::make_shared<AcceptingObjectApprover>());
1222 }
1223
1224 return Owned<ObjectApprovers>(
1225 new ObjectApprovers(std::move(approvers), principal));
1226 }
1227
1228 return process::collect(lambda::map<vector>(
1229 [&](authorization::Action action) {
1230 return authorizer.get()->getApprover(subject, action);
1231 },
1232 _actions))
1233 .then([=](const vector<shared_ptr<const ObjectApprover>>& _approvers) {
1234 return Owned<ObjectApprovers>(
1235 new ObjectApprovers(lambda::zip(_actions, _approvers), principal));
1236 });
1237}
1238
1239
1240process::Future<bool> authorizeEndpoint(

Callers 2

getResourceProviderIdFunction · 0.45

Calls 7

createSubjectFunction · 0.85
collectFunction · 0.85
zipFunction · 0.85
isNoneMethod · 0.45
thenMethod · 0.45
getApproverMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected