protected function ApiProductRoleBasedAccessTestBase::saveAccessSettings in Apigee Edge 8
Saves access settings to its appreciated place.
Parameters
array $settings: Associate array where keys are public, private, internal and values are role ids.
Overrides ApiProductAccessTest::saveAccessSettings
File
- modules/
apigee_edge_apiproduct_rbac/ tests/ src/ FunctionalJavascript/ ApiProductRoleBasedAccessTestBase.php, line 77
Class
- ApiProductRoleBasedAccessTestBase
- Base calls for validating role based access control on API products.
Namespace
Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascriptCode
protected function saveAccessSettings(array $settings) {
$post = [];
foreach (array_keys($this->roleStorage
->loadMultiple()) as $rid) {
foreach ($settings as $visibility => $roles) {
if (in_array($rid, $roles)) {
$post["rbac[{$rid}][{$this->apiProducts[$visibility]->id()}]"] = TRUE;
}
else {
$post["rbac[{$rid}][{$this->apiProducts[$visibility]->id()}]"] = FALSE;
}
}
}
$this
->drupalLogin($this->users[self::USER_WITH_ADMIN_PERM]);
$this
->drupalPostForm(Url::fromRoute('apigee_edge.settings.developer.api_product_access'), $post, 'Save configuration');
$this
->drupalLogout();
}