| 1259 | |
| 1260 | private: |
| 1261 | static Result<vector<GenericACL>> createGenericACLs( |
| 1262 | const authorization::Action& action, |
| 1263 | const ACLs& acls) |
| 1264 | { |
| 1265 | vector<GenericACL> acls_; |
| 1266 | |
| 1267 | switch (action) { |
| 1268 | case authorization::TEARDOWN_FRAMEWORK: |
| 1269 | foreach ( |
| 1270 | const ACL::TeardownFramework& acl, acls.teardown_frameworks()) { |
| 1271 | GenericACL acl_; |
| 1272 | acl_.subjects = acl.principals(); |
| 1273 | acl_.objects = acl.framework_principals(); |
| 1274 | |
| 1275 | acls_.push_back(acl_); |
| 1276 | } |
| 1277 | |
| 1278 | return acls_; |
| 1279 | case authorization::RUN_TASK: |
| 1280 | foreach (const ACL::RunTask& acl, acls.run_tasks()) { |
| 1281 | GenericACL acl_; |
| 1282 | acl_.subjects = acl.principals(); |
| 1283 | acl_.objects = acl.users(); |
| 1284 | |
| 1285 | acls_.push_back(acl_); |
| 1286 | } |
| 1287 | |
| 1288 | return acls_; |
| 1289 | case authorization::UNRESERVE_RESOURCES: |
| 1290 | foreach ( |
| 1291 | const ACL::UnreserveResources& acl, acls.unreserve_resources()) { |
| 1292 | GenericACL acl_; |
| 1293 | acl_.subjects = acl.principals(); |
| 1294 | acl_.objects = acl.reserver_principals(); |
| 1295 | |
| 1296 | acls_.push_back(acl_); |
| 1297 | } |
| 1298 | |
| 1299 | return acls_; |
| 1300 | case authorization::DESTROY_VOLUME: |
| 1301 | foreach (const ACL::DestroyVolume& acl, acls.destroy_volumes()) { |
| 1302 | GenericACL acl_; |
| 1303 | acl_.subjects = acl.principals(); |
| 1304 | acl_.objects = acl.creator_principals(); |
| 1305 | |
| 1306 | acls_.push_back(acl_); |
| 1307 | } |
| 1308 | |
| 1309 | return acls_; |
| 1310 | case authorization::GET_ENDPOINT_WITH_PATH: |
| 1311 | foreach (const ACL::GetEndpoint& acl, acls.get_endpoints()) { |
| 1312 | GenericACL acl_; |
| 1313 | acl_.subjects = acl.principals(); |
| 1314 | acl_.objects = acl.paths(); |
| 1315 | |
| 1316 | acls_.push_back(acl_); |
| 1317 | } |
| 1318 | |