protected function addAccessRulesToRole($role, Config $rules)
{
foreach ($rules as $method => $rules) {
// skip not wanted rules
if (in_array($method, ['inherit', 'description'])) {
continue;
}
foreach ($rules as $controller => $actionRules) {
$actions = $this->castAction($actionRules->get('actions'));
if (!in_array($method, ['allow', 'deny'])) {
throw new Exception(sprintf('Wrong access method given. Expected "allow" or "deny" but "%s" was set.', $method));
}
$this->acl->{$method}($role, $controller, $actions);
}
}
return $this;
}