{"action":"created","comment":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/comments/28136590","id":28136590,"diff_hunk":"@@ -46,7 +46,7 @@\n                     {% block navigation %}\n                     <ul id=\"header-menu\">\n                         {% block navigation_items %}\n-                        {% for item in easyadmin_config('entities') %}\n+                        {% for item in easyadmin_config('entities') if is_granted(item.role|default('IS_AUTHENTICATED_ANONYMOUSLY')) %}","path":"Resources/views/layout.html.twig","position":5,"original_position":5,"commit_id":"76d49018b22523cdd3a3a653268471b8082e872c","original_commit_id":"76d49018b22523cdd3a3a653268471b8082e872c","user":{"login":"aruku","id":3179605,"avatar_url":"https://avatars.githubusercontent.com/u/3179605?v=3","gravatar_id":"","url":"https://api.github.com/users/aruku","html_url":"https://github.com/aruku","followers_url":"https://api.github.com/users/aruku/followers","following_url":"https://api.github.com/users/aruku/following{/other_user}","gists_url":"https://api.github.com/users/aruku/gists{/gist_id}","starred_url":"https://api.github.com/users/aruku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruku/subscriptions","organizations_url":"https://api.github.com/users/aruku/orgs","repos_url":"https://api.github.com/users/aruku/repos","events_url":"https://api.github.com/users/aruku/events{/privacy}","received_events_url":"https://api.github.com/users/aruku/received_events","type":"User","site_admin":false},"body":"Shouldn't it be `if item.role is defined or is_granted(item.role)`?\r\nThe way you say it still crash when the entity doesn't have the role defined.\r\n\r\nI figured out the right way to apply it to this foreach filter:\r\n`if item.role is not defined or is_granted(item.role)`\r\nThat way it wouldn't crash it the role is not defined and it will still work when it is.\r\nThanks!","created_at":"2015-04-10T10:59:28Z","updated_at":"2015-04-10T10:59:28Z","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218#discussion_r28136590","pull_request_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218","_links":{"self":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/comments/28136590"},"html":{"href":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218#discussion_r28136590"},"pull_request":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218"}}},"pull_request":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218","id":33033478,"html_url":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218","diff_url":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218.diff","patch_url":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218.patch","issue_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/218","number":218,"state":"closed","locked":false,"title":"Simple permissions management using roles","user":{"login":"aruku","id":3179605,"avatar_url":"https://avatars.githubusercontent.com/u/3179605?v=3","gravatar_id":"","url":"https://api.github.com/users/aruku","html_url":"https://github.com/aruku","followers_url":"https://api.github.com/users/aruku/followers","following_url":"https://api.github.com/users/aruku/following{/other_user}","gists_url":"https://api.github.com/users/aruku/gists{/gist_id}","starred_url":"https://api.github.com/users/aruku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruku/subscriptions","organizations_url":"https://api.github.com/users/aruku/orgs","repos_url":"https://api.github.com/users/aruku/repos","events_url":"https://api.github.com/users/aruku/events{/privacy}","received_events_url":"https://api.github.com/users/aruku/received_events","type":"User","site_admin":false},"body":"With this tiny change we can control whether the user needs a specific role granted to access an entity management screen. Related with #216.\r\nEDIT: I just discovered that GitHub doesn't match the user I made the commits with with the one I use here; I guess that's because I have two different ssh keys in my system, one with my company's email address and another with a personal email. If this a problem, I'll redo the commits with the right user or try to get GitHub to know that user is me.","created_at":"2015-04-10T10:04:23Z","updated_at":"2015-04-10T10:59:28Z","closed_at":"2015-04-10T10:40:33Z","merged_at":null,"merge_commit_sha":"4a10093ba22a8ce4cdf98294e78030eb8399068c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218/commits","review_comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218/comments","review_comment_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/218/comments","statuses_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/statuses/76d49018b22523cdd3a3a653268471b8082e872c","head":{"label":"aruku:permissions_mgmt","ref":"permissions_mgmt","sha":"76d49018b22523cdd3a3a653268471b8082e872c","user":{"login":"aruku","id":3179605,"avatar_url":"https://avatars.githubusercontent.com/u/3179605?v=3","gravatar_id":"","url":"https://api.github.com/users/aruku","html_url":"https://github.com/aruku","followers_url":"https://api.github.com/users/aruku/followers","following_url":"https://api.github.com/users/aruku/following{/other_user}","gists_url":"https://api.github.com/users/aruku/gists{/gist_id}","starred_url":"https://api.github.com/users/aruku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruku/subscriptions","organizations_url":"https://api.github.com/users/aruku/orgs","repos_url":"https://api.github.com/users/aruku/repos","events_url":"https://api.github.com/users/aruku/events{/privacy}","received_events_url":"https://api.github.com/users/aruku/received_events","type":"User","site_admin":false},"repo":{"id":33666275,"name":"EasyAdminBundle","full_name":"aruku/EasyAdminBundle","owner":{"login":"aruku","id":3179605,"avatar_url":"https://avatars.githubusercontent.com/u/3179605?v=3","gravatar_id":"","url":"https://api.github.com/users/aruku","html_url":"https://github.com/aruku","followers_url":"https://api.github.com/users/aruku/followers","following_url":"https://api.github.com/users/aruku/following{/other_user}","gists_url":"https://api.github.com/users/aruku/gists{/gist_id}","starred_url":"https://api.github.com/users/aruku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruku/subscriptions","organizations_url":"https://api.github.com/users/aruku/orgs","repos_url":"https://api.github.com/users/aruku/repos","events_url":"https://api.github.com/users/aruku/events{/privacy}","received_events_url":"https://api.github.com/users/aruku/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aruku/EasyAdminBundle","description":"The new (and simple) admin generator for Symfony applications.","fork":true,"url":"https://api.github.com/repos/aruku/EasyAdminBundle","forks_url":"https://api.github.com/repos/aruku/EasyAdminBundle/forks","keys_url":"https://api.github.com/repos/aruku/EasyAdminBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aruku/EasyAdminBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aruku/EasyAdminBundle/teams","hooks_url":"https://api.github.com/repos/aruku/EasyAdminBundle/hooks","issue_events_url":"https://api.github.com/repos/aruku/EasyAdminBundle/issues/events{/number}","events_url":"https://api.github.com/repos/aruku/EasyAdminBundle/events","assignees_url":"https://api.github.com/repos/aruku/EasyAdminBundle/assignees{/user}","branches_url":"https://api.github.com/repos/aruku/EasyAdminBundle/branches{/branch}","tags_url":"https://api.github.com/repos/aruku/EasyAdminBundle/tags","blobs_url":"https://api.github.com/repos/aruku/EasyAdminBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aruku/EasyAdminBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aruku/EasyAdminBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/aruku/EasyAdminBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aruku/EasyAdminBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/aruku/EasyAdminBundle/languages","stargazers_url":"https://api.github.com/repos/aruku/EasyAdminBundle/stargazers","contributors_url":"https://api.github.com/repos/aruku/EasyAdminBundle/contributors","subscribers_url":"https://api.github.com/repos/aruku/EasyAdminBundle/subscribers","subscription_url":"https://api.github.com/repos/aruku/EasyAdminBundle/subscription","commits_url":"https://api.github.com/repos/aruku/EasyAdminBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/aruku/EasyAdminBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/aruku/EasyAdminBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/aruku/EasyAdminBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/aruku/EasyAdminBundle/contents/{+path}","compare_url":"https://api.github.com/repos/aruku/EasyAdminBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aruku/EasyAdminBundle/merges","archive_url":"https://api.github.com/repos/aruku/EasyAdminBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aruku/EasyAdminBundle/downloads","issues_url":"https://api.github.com/repos/aruku/EasyAdminBundle/issues{/number}","pulls_url":"https://api.github.com/repos/aruku/EasyAdminBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/aruku/EasyAdminBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/aruku/EasyAdminBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aruku/EasyAdminBundle/labels{/name}","releases_url":"https://api.github.com/repos/aruku/EasyAdminBundle/releases{/id}","created_at":"2015-04-09T11:56:21Z","updated_at":"2015-04-09T11:56:22Z","pushed_at":"2015-04-10T09:55:52Z","git_url":"git://github.com/aruku/EasyAdminBundle.git","ssh_url":"git@github.com:aruku/EasyAdminBundle.git","clone_url":"https://github.com/aruku/EasyAdminBundle.git","svn_url":"https://github.com/aruku/EasyAdminBundle","homepage":"","size":6239,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"javiereguiluz:master","ref":"master","sha":"ea8369b303c7ee2dff73df992225c78037126f9f","user":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars.githubusercontent.com/u/73419?v=3","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"repo":{"id":29126334,"name":"EasyAdminBundle","full_name":"javiereguiluz/EasyAdminBundle","owner":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars.githubusercontent.com/u/73419?v=3","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/javiereguiluz/EasyAdminBundle","description":"The new (and simple) admin generator for Symfony applications.","fork":false,"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle","forks_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/forks","keys_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/teams","hooks_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/hooks","issue_events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/events{/number}","events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/events","assignees_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/assignees{/user}","branches_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/branches{/branch}","tags_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/tags","blobs_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/languages","stargazers_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/stargazers","contributors_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/contributors","subscribers_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/subscribers","subscription_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/subscription","commits_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/contents/{+path}","compare_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/merges","archive_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/downloads","issues_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues{/number}","pulls_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/labels{/name}","releases_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/releases{/id}","created_at":"2015-01-12T08:43:02Z","updated_at":"2015-04-10T10:46:16Z","pushed_at":"2015-04-10T10:46:16Z","git_url":"git://github.com/javiereguiluz/EasyAdminBundle.git","ssh_url":"git@github.com:javiereguiluz/EasyAdminBundle.git","clone_url":"https://github.com/javiereguiluz/EasyAdminBundle.git","svn_url":"https://github.com/javiereguiluz/EasyAdminBundle","homepage":"","size":6239,"stargazers_count":504,"watchers_count":504,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":13,"forks":50,"open_issues":13,"watchers":504,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218"},"html":{"href":"https://github.com/javiereguiluz/EasyAdminBundle/pull/218"},"issue":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/218"},"comments":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/218/comments"},"review_comments":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218/comments"},"review_comment":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/pulls/218/commits"},"statuses":{"href":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/statuses/76d49018b22523cdd3a3a653268471b8082e872c"}}}}