{"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/36945234","id":36945234,"diff_hunk":"@@ -347,6 +347,20 @@ def fullscreen_button(element = \"$(this).prev()\")\n   private\n \n   def authorized_associations(associations)\n-    associations.included_modules.include?(Authorizable) ? associations.authorized : associations\n+    if associations.included_modules.include?(Authorizable)\n+      if associations.respond_to?(:klass)\n+        associations.authorized(authorized_assocations_permission_name(associations.klass), associations.klass)\n+      else\n+        associations.authorized(authorized_assocations_permission_name(associations), associations)\n+      end\n+    else\n+      associations\n+    end\n+  end\n+\n+  def authorized_assocations_permission_name(klass)\n+    permission = \"view_#{klass.to_s.underscore.pluralize}\"\n+    return nil unless Permission.where(:name => permission).present?","path":"app/helpers/layout_helper.rb","position":null,"original_position":18,"commit_id":"5128ff7603a1ab4c064dc102128ce3f919daf4c0","original_commit_id":"687fd64c014a006b7674c5ee68b2fbac828aea7a","user":{"login":"ares","id":109773,"avatar_url":"https://avatars.githubusercontent.com/u/109773?v=3","gravatar_id":"","url":"https://api.github.com/users/ares","html_url":"https://github.com/ares","followers_url":"https://api.github.com/users/ares/followers","following_url":"https://api.github.com/users/ares/following{/other_user}","gists_url":"https://api.github.com/users/ares/gists{/gist_id}","starred_url":"https://api.github.com/users/ares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ares/subscriptions","organizations_url":"https://api.github.com/users/ares/orgs","repos_url":"https://api.github.com/users/ares/repos","events_url":"https://api.github.com/users/ares/events{/privacy}","received_events_url":"https://api.github.com/users/ares/received_events","type":"User","site_admin":false},"body":"it evolved from the 1.10 variant but makes more sense to write it as you suggested, I even added a comment even though this code won't be probably updated","created_at":"2015-08-13T06:51:19Z","updated_at":"2015-08-13T06:51:19Z","html_url":"https://github.com/theforeman/foreman/pull/2598#discussion_r36945234","pull_request_url":"https://api.github.com/repos/theforeman/foreman/pulls/2598","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/36945234"},"html":{"href":"https://github.com/theforeman/foreman/pull/2598#discussion_r36945234"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2598"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/2598","id":42008512,"html_url":"https://github.com/theforeman/foreman/pull/2598","diff_url":"https://github.com/theforeman/foreman/pull/2598.diff","patch_url":"https://github.com/theforeman/foreman/pull/2598.patch","issue_url":"https://api.github.com/repos/theforeman/foreman/issues/2598","number":2598,"state":"open","locked":false,"title":"Fixes #11187 - explicitly pass resource_type and permission to check","user":{"login":"ares","id":109773,"avatar_url":"https://avatars.githubusercontent.com/u/109773?v=3","gravatar_id":"","url":"https://api.github.com/users/ares","html_url":"https://github.com/ares","followers_url":"https://api.github.com/users/ares/followers","following_url":"https://api.github.com/users/ares/following{/other_user}","gists_url":"https://api.github.com/users/ares/gists{/gist_id}","starred_url":"https://api.github.com/users/ares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ares/subscriptions","organizations_url":"https://api.github.com/users/ares/orgs","repos_url":"https://api.github.com/users/ares/repos","events_url":"https://api.github.com/users/ares/events{/privacy}","received_events_url":"https://api.github.com/users/ares/received_events","type":"User","site_admin":false},"body":"A slightly safer way of fixing redmine issue [11187](http://projects.theforeman.org/issues/11187) for Foreman 1.9. See #2564 for more information.","created_at":"2015-08-10T11:02:55Z","updated_at":"2015-08-13T06:51:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"209d2ee5289e5dab56d7104904c6fbc3a49353b9","assignee":{"login":"domcleal","id":482089,"avatar_url":"https://avatars.githubusercontent.com/u/482089?v=3","gravatar_id":"","url":"https://api.github.com/users/domcleal","html_url":"https://github.com/domcleal","followers_url":"https://api.github.com/users/domcleal/followers","following_url":"https://api.github.com/users/domcleal/following{/other_user}","gists_url":"https://api.github.com/users/domcleal/gists{/gist_id}","starred_url":"https://api.github.com/users/domcleal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domcleal/subscriptions","organizations_url":"https://api.github.com/users/domcleal/orgs","repos_url":"https://api.github.com/users/domcleal/repos","events_url":"https://api.github.com/users/domcleal/events{/privacy}","received_events_url":"https://api.github.com/users/domcleal/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/theforeman/foreman/pulls/2598/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman/pulls/2598/comments","review_comment_url":"https://api.github.com/repos/theforeman/foreman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/theforeman/foreman/issues/2598/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/5128ff7603a1ab4c064dc102128ce3f919daf4c0","head":{"label":"ares:fix/11187_1.9-stable","ref":"fix/11187_1.9-stable","sha":"5128ff7603a1ab4c064dc102128ce3f919daf4c0","user":{"login":"ares","id":109773,"avatar_url":"https://avatars.githubusercontent.com/u/109773?v=3","gravatar_id":"","url":"https://api.github.com/users/ares","html_url":"https://github.com/ares","followers_url":"https://api.github.com/users/ares/followers","following_url":"https://api.github.com/users/ares/following{/other_user}","gists_url":"https://api.github.com/users/ares/gists{/gist_id}","starred_url":"https://api.github.com/users/ares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ares/subscriptions","organizations_url":"https://api.github.com/users/ares/orgs","repos_url":"https://api.github.com/users/ares/repos","events_url":"https://api.github.com/users/ares/events{/privacy}","received_events_url":"https://api.github.com/users/ares/received_events","type":"User","site_admin":false},"repo":{"id":8576886,"name":"foreman","full_name":"ares/foreman","owner":{"login":"ares","id":109773,"avatar_url":"https://avatars.githubusercontent.com/u/109773?v=3","gravatar_id":"","url":"https://api.github.com/users/ares","html_url":"https://github.com/ares","followers_url":"https://api.github.com/users/ares/followers","following_url":"https://api.github.com/users/ares/following{/other_user}","gists_url":"https://api.github.com/users/ares/gists{/gist_id}","starred_url":"https://api.github.com/users/ares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ares/subscriptions","organizations_url":"https://api.github.com/users/ares/orgs","repos_url":"https://api.github.com/users/ares/repos","events_url":"https://api.github.com/users/ares/events{/privacy}","received_events_url":"https://api.github.com/users/ares/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ares/foreman","description":"an application that automates the lifecycle of servers ","fork":true,"url":"https://api.github.com/repos/ares/foreman","forks_url":"https://api.github.com/repos/ares/foreman/forks","keys_url":"https://api.github.com/repos/ares/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ares/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ares/foreman/teams","hooks_url":"https://api.github.com/repos/ares/foreman/hooks","issue_events_url":"https://api.github.com/repos/ares/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/ares/foreman/events","assignees_url":"https://api.github.com/repos/ares/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/ares/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/ares/foreman/tags","blobs_url":"https://api.github.com/repos/ares/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ares/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ares/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/ares/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ares/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/ares/foreman/languages","stargazers_url":"https://api.github.com/repos/ares/foreman/stargazers","contributors_url":"https://api.github.com/repos/ares/foreman/contributors","subscribers_url":"https://api.github.com/repos/ares/foreman/subscribers","subscription_url":"https://api.github.com/repos/ares/foreman/subscription","commits_url":"https://api.github.com/repos/ares/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/ares/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/ares/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/ares/foreman/issues/comments{/number}","contents_url":"https://api.github.com/repos/ares/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/ares/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ares/foreman/merges","archive_url":"https://api.github.com/repos/ares/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ares/foreman/downloads","issues_url":"https://api.github.com/repos/ares/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/ares/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/ares/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/ares/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ares/foreman/labels{/name}","releases_url":"https://api.github.com/repos/ares/foreman/releases{/id}","created_at":"2013-03-05T09:59:59Z","updated_at":"2014-08-19T11:27:01Z","pushed_at":"2015-08-13T06:49:31Z","git_url":"git://github.com/ares/foreman.git","ssh_url":"git@github.com:ares/foreman.git","clone_url":"https://github.com/ares/foreman.git","svn_url":"https://github.com/ares/foreman","homepage":"http://theforeman.org","size":31764,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"theforeman:1.9-stable","ref":"1.9-stable","sha":"c66446f76a5535802f25fa881843c22ce413cb81","user":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"repo":{"id":258750,"name":"foreman","full_name":"theforeman/foreman","owner":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/theforeman/foreman","description":"an application that automates the lifecycle of servers ","fork":false,"url":"https://api.github.com/repos/theforeman/foreman","forks_url":"https://api.github.com/repos/theforeman/foreman/forks","keys_url":"https://api.github.com/repos/theforeman/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theforeman/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theforeman/foreman/teams","hooks_url":"https://api.github.com/repos/theforeman/foreman/hooks","issue_events_url":"https://api.github.com/repos/theforeman/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/theforeman/foreman/events","assignees_url":"https://api.github.com/repos/theforeman/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/theforeman/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/theforeman/foreman/tags","blobs_url":"https://api.github.com/repos/theforeman/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theforeman/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theforeman/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/theforeman/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/theforeman/foreman/languages","stargazers_url":"https://api.github.com/repos/theforeman/foreman/stargazers","contributors_url":"https://api.github.com/repos/theforeman/foreman/contributors","subscribers_url":"https://api.github.com/repos/theforeman/foreman/subscribers","subscription_url":"https://api.github.com/repos/theforeman/foreman/subscription","commits_url":"https://api.github.com/repos/theforeman/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/theforeman/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/theforeman/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/theforeman/foreman/issues/comments{/number}","contents_url":"https://api.github.com/repos/theforeman/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/theforeman/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theforeman/foreman/merges","archive_url":"https://api.github.com/repos/theforeman/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theforeman/foreman/downloads","issues_url":"https://api.github.com/repos/theforeman/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/theforeman/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/theforeman/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/theforeman/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theforeman/foreman/labels{/name}","releases_url":"https://api.github.com/repos/theforeman/foreman/releases{/id}","created_at":"2009-07-23T15:07:00Z","updated_at":"2015-08-12T18:55:01Z","pushed_at":"2015-08-13T06:49:32Z","git_url":"git://github.com/theforeman/foreman.git","ssh_url":"git@github.com:theforeman/foreman.git","clone_url":"https://github.com/theforeman/foreman.git","svn_url":"https://github.com/theforeman/foreman","homepage":"http://theforeman.org","size":86546,"stargazers_count":824,"watchers_count":824,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":423,"mirror_url":null,"open_issues_count":84,"forks":423,"open_issues":84,"watchers":824,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2598"},"html":{"href":"https://github.com/theforeman/foreman/pull/2598"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2598"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2598/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2598/comments"},"review_comment":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2598/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman/statuses/5128ff7603a1ab4c064dc102128ce3f919daf4c0"}}}}