{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/216429235","pull_request_review_id":153907870,"id":216429235,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjQyOTIzNQ==","diff_hunk":"@@ -557,6 +561,8 @@ def scope_targets(klass, scope, rbac_filters, user, miq_group)\n \n         filtered_ids = calc_filtered_ids(associated_class, rbac_filters, user, miq_group, scope_tenant_filter)\n         scope_by_parent_ids(associated_class, scope, filtered_ids)\n+      elsif apply_rbac_by_scope_in?(klass)","path":"lib/rbac/filterer.rb","position":15,"original_position":15,"commit_id":"c8bc981fc502b05a145ebc9676254bb4dc373a25","original_commit_id":"a46c88d11f520dd57ecf9166f8ff925fedb9b862","user":{"login":"skateman","id":649130,"node_id":"MDQ6VXNlcjY0OTEzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/649130?v=4","gravatar_id":"","url":"https://api.github.com/users/skateman","html_url":"https://github.com/skateman","followers_url":"https://api.github.com/users/skateman/followers","following_url":"https://api.github.com/users/skateman/following{/other_user}","gists_url":"https://api.github.com/users/skateman/gists{/gist_id}","starred_url":"https://api.github.com/users/skateman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skateman/subscriptions","organizations_url":"https://api.github.com/users/skateman/orgs","repos_url":"https://api.github.com/users/skateman/repos","events_url":"https://api.github.com/users/skateman/events{/privacy}","received_events_url":"https://api.github.com/users/skateman/received_events","type":"User","site_admin":false},"body":"I got the info from @h-kataria that we want these things for admin and super admin users only.","created_at":"2018-09-10T18:36:06Z","updated_at":"2018-09-10T18:36:06Z","html_url":"https://github.com/ManageIQ/manageiq/pull/17954#discussion_r216429235","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/216429235"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/17954#discussion_r216429235"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954"}},"in_reply_to_id":215991702},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954","id":213863319,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzODYzMzE5","html_url":"https://github.com/ManageIQ/manageiq/pull/17954","diff_url":"https://github.com/ManageIQ/manageiq/pull/17954.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/17954.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/17954","number":17954,"state":"open","locked":false,"title":"Add scope in model ability to RBAC","user":{"login":"lpichler","id":14937244,"node_id":"MDQ6VXNlcjE0OTM3MjQ0","avatar_url":"https://avatars0.githubusercontent.com/u/14937244?v=4","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"body":"created for @skateman 🎁 \r\n\r\nhe wanted to restrict visibility of `CustomButtonEvents` for non super-admin.\r\n\r\n_NOTE: admin user has been removed by @kbrock's recent work(probably last PR  ot the work https://github.com/ManageIQ/manageiq/pull/17850) in order to have just specialized admin users._   -  **So this PR is allowing visibility just for super_admins.**\r\n\r\n### Implementation \r\n\r\nI decided to add to RBAC a other concept(`scope_for_model?`) - it will allow to define scope in models to reach required behaviour. (maybe similar to `scope_for_user_role_group`) \r\n\r\n### Example of future usage( for other models)\r\nThis will be also usable for MiqSchedule, when you look in UI you will see  on couple places:\r\n```\r\nif User.super_admin?\r\n                # Super admins see all report schedules\r\n                MiqSchedule.where(:towhat => 'MiqReport')\r\n              else\r\n                MiqSchedule.where(:towhat => 'MiqReport', :userid => User.current_user.userid)\r\n              end\r\n```\r\n\r\n@miq-bot assign @gtanzillo ","created_at":"2018-09-07T09:08:07Z","updated_at":"2018-09-10T18:36:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4fd8a344d74127647e9e438963682b3081d489b","assignee":{"login":"gtanzillo","id":76593,"node_id":"MDQ6VXNlcjc2NTkz","avatar_url":"https://avatars3.githubusercontent.com/u/76593?v=4","gravatar_id":"","url":"https://api.github.com/users/gtanzillo","html_url":"https://github.com/gtanzillo","followers_url":"https://api.github.com/users/gtanzillo/followers","following_url":"https://api.github.com/users/gtanzillo/following{/other_user}","gists_url":"https://api.github.com/users/gtanzillo/gists{/gist_id}","starred_url":"https://api.github.com/users/gtanzillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtanzillo/subscriptions","organizations_url":"https://api.github.com/users/gtanzillo/orgs","repos_url":"https://api.github.com/users/gtanzillo/repos","events_url":"https://api.github.com/users/gtanzillo/events{/privacy}","received_events_url":"https://api.github.com/users/gtanzillo/received_events","type":"User","site_admin":false},"assignees":[{"login":"gtanzillo","id":76593,"node_id":"MDQ6VXNlcjc2NTkz","avatar_url":"https://avatars3.githubusercontent.com/u/76593?v=4","gravatar_id":"","url":"https://api.github.com/users/gtanzillo","html_url":"https://github.com/gtanzillo","followers_url":"https://api.github.com/users/gtanzillo/followers","following_url":"https://api.github.com/users/gtanzillo/following{/other_user}","gists_url":"https://api.github.com/users/gtanzillo/gists{/gist_id}","starred_url":"https://api.github.com/users/gtanzillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtanzillo/subscriptions","organizations_url":"https://api.github.com/users/gtanzillo/orgs","repos_url":"https://api.github.com/users/gtanzillo/repos","events_url":"https://api.github.com/users/gtanzillo/events{/privacy}","received_events_url":"https://api.github.com/users/gtanzillo/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":106615678,"node_id":"MDU6TGFiZWwxMDY2MTU2Nzg=","url":"https://api.github.com/repos/ManageIQ/manageiq/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":297146491,"node_id":"MDU6TGFiZWwyOTcxNDY0OTE=","url":"https://api.github.com/repos/ManageIQ/manageiq/labels/rbac","name":"rbac","color":"5319e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/17954/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/c8bc981fc502b05a145ebc9676254bb4dc373a25","head":{"label":"lpichler:add_rbac_by_scope_in_model","ref":"add_rbac_by_scope_in_model","sha":"c8bc981fc502b05a145ebc9676254bb4dc373a25","user":{"login":"lpichler","id":14937244,"node_id":"MDQ6VXNlcjE0OTM3MjQ0","avatar_url":"https://avatars0.githubusercontent.com/u/14937244?v=4","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"repo":{"id":43540953,"node_id":"MDEwOlJlcG9zaXRvcnk0MzU0MDk1Mw==","name":"manageiq","full_name":"lpichler/manageiq","owner":{"login":"lpichler","id":14937244,"node_id":"MDQ6VXNlcjE0OTM3MjQ0","avatar_url":"https://avatars0.githubusercontent.com/u/14937244?v=4","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lpichler/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/lpichler/manageiq","forks_url":"https://api.github.com/repos/lpichler/manageiq/forks","keys_url":"https://api.github.com/repos/lpichler/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lpichler/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lpichler/manageiq/teams","hooks_url":"https://api.github.com/repos/lpichler/manageiq/hooks","issue_events_url":"https://api.github.com/repos/lpichler/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/lpichler/manageiq/events","assignees_url":"https://api.github.com/repos/lpichler/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/lpichler/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/lpichler/manageiq/tags","blobs_url":"https://api.github.com/repos/lpichler/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lpichler/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lpichler/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/lpichler/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lpichler/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/lpichler/manageiq/languages","stargazers_url":"https://api.github.com/repos/lpichler/manageiq/stargazers","contributors_url":"https://api.github.com/repos/lpichler/manageiq/contributors","subscribers_url":"https://api.github.com/repos/lpichler/manageiq/subscribers","subscription_url":"https://api.github.com/repos/lpichler/manageiq/subscription","commits_url":"https://api.github.com/repos/lpichler/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/lpichler/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/lpichler/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/lpichler/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/lpichler/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/lpichler/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lpichler/manageiq/merges","archive_url":"https://api.github.com/repos/lpichler/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lpichler/manageiq/downloads","issues_url":"https://api.github.com/repos/lpichler/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/lpichler/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/lpichler/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/lpichler/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lpichler/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/lpichler/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/lpichler/manageiq/deployments","created_at":"2015-10-02T07:37:28Z","updated_at":"2018-09-10T08:19:50Z","pushed_at":"2018-09-10T17:19:59Z","git_url":"git://github.com/lpichler/manageiq.git","ssh_url":"git@github.com:lpichler/manageiq.git","clone_url":"https://github.com/lpichler/manageiq.git","svn_url":"https://github.com/lpichler/manageiq","homepage":"manageiq.org","size":242904,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"b3a5bd84710a155b558fbe9000ad8a6b0c203b74","user":{"login":"ManageIQ","id":1125575,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjU1NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"node_id":"MDEwOlJlcG9zaXRvcnkyMDc4OTc1Nw==","name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjU1NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Open-Source Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2018-09-10T16:19:22Z","pushed_at":"2018-09-10T18:20:59Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":256687,"stargazers_count":706,"watchers_count":706,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":657,"mirror_url":null,"archived":false,"open_issues_count":588,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":657,"open_issues":588,"watchers":706,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/17954"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/17954"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/17954/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/17954/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/c8bc981fc502b05a145ebc9676254bb4dc373a25"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"skateman"}}