{"action":"opened","issue":{"url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1488","labels_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1488/labels{/name}","comments_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1488/comments","events_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1488/events","html_url":"https://github.com/ryancramerdesign/ProcessWire/issues/1488","id":114579469,"number":1488,"title":"Template::setRoles inconsistancy","user":{"login":"LostKobrakai","id":2489835,"avatar_url":"https://avatars.githubusercontent.com/u/2489835?v=3","gravatar_id":"","url":"https://api.github.com/users/LostKobrakai","html_url":"https://github.com/LostKobrakai","followers_url":"https://api.github.com/users/LostKobrakai/followers","following_url":"https://api.github.com/users/LostKobrakai/following{/other_user}","gists_url":"https://api.github.com/users/LostKobrakai/gists{/gist_id}","starred_url":"https://api.github.com/users/LostKobrakai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LostKobrakai/subscriptions","organizations_url":"https://api.github.com/users/LostKobrakai/orgs","repos_url":"https://api.github.com/users/LostKobrakai/repos","events_url":"https://api.github.com/users/LostKobrakai/events{/privacy}","received_events_url":"https://api.github.com/users/LostKobrakai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-02T11:49:22Z","updated_at":"2015-11-02T11:49:22Z","closed_at":null,"body":"Is there a reason why setRoles does accept plain array values per the function implementation, but not saving the view access rules when it's an array of pages? The following code would work without the PageArray obj for edit, create and add, but not for the view roles.\r\n\r\n```php\r\n…\r\n$access = array(\r\n    \"view\" => array(\"guest\", \"editor\"),\r\n    \"edit\" => …\r\n);\r\n\r\nforeach ($access as $key => $rolesArray) {\r\n    $rolesArray = array_map(function($role) use($roles) {\r\n        return $roles->get(\"name=$role\");\r\n    }, $rolesArray);\r\n\r\n    $rolesPA = new PageArray();\r\n    $rolesPA = $rolesPA->import($rolesArray);\r\n\r\n    $template->setRoles($rolesPA, $key);\r\n}\r\n\r\n$template->save();\r\n```"}}