{"action":"created","comment":{"url":"https://api.github.com/repos/sul-dlss/argo/pulls/comments/54123398","id":54123398,"diff_hunk":"@@ -360,6 +360,376 @@ def groups_to_impersonate\n     end\n   end\n \n+  describe '#can_admin?' do\n+    before :each do\n+      expect(subject).not_to receive(:is_manager)\n+      expect(subject).not_to receive(:is_viewer)\n+    end\n+\n+    shared_examples 'Argo grants permission to manage object' do\n+      it 'permits admin' do\n+        expect(subject).to receive(:is_admin).once.and_return(true)\n+        expect(subject).not_to receive(:is_manager)","path":"spec/models/user_spec.rb","position":122,"original_position":13,"commit_id":"43eeb555bb483459d93e6eca5586db7b03c6ff95","original_commit_id":"271b343bdda8f47835787433a9911f559861d850","user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"body":"No it's not.","created_at":"2016-02-25T16:36:56Z","updated_at":"2016-02-25T16:36:56Z","html_url":"https://github.com/sul-dlss/argo/pull/585#discussion_r54123398","pull_request_url":"https://api.github.com/repos/sul-dlss/argo/pulls/585","_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/comments/54123398"},"html":{"href":"https://github.com/sul-dlss/argo/pull/585#discussion_r54123398"},"pull_request":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/585"}}},"pull_request":{"url":"https://api.github.com/repos/sul-dlss/argo/pulls/585","id":60618149,"html_url":"https://github.com/sul-dlss/argo/pull/585","diff_url":"https://github.com/sul-dlss/argo/pull/585.diff","patch_url":"https://github.com/sul-dlss/argo/pull/585.patch","issue_url":"https://api.github.com/repos/sul-dlss/argo/issues/585","number":585,"state":"open","locked":false,"title":"Create User#can_admin?, User#can_manage? and User#can_view?","user":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"body":"This PR is just about creating additional `User` methods that can be used in authorization.  Examples of it's use are in https://github.com/sul-dlss/argo/commit/214acb7598d532a0f6b49e4675a28966b5259713, but this PR does not use it anywhere in the app (yet).  The core of this PR is in the ability of the user model to check permissions on any DOR object, which is consolidated in this method:\r\nhttps://github.com/sul-dlss/argo/blob/enhance-user-permissions/app/models/user.rb#L229-L248\r\n\r\nThis is an extract from a larger goal that was previously proposed in https://github.com/sul-dlss/argo/pull/532, but that work is too complex to evaluate.  Smaller chunks of that work can proceed and gradually accomplish the same outcome.\r\n","created_at":"2016-02-25T03:06:58Z","updated_at":"2016-02-25T16:36:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c83350ec35259bd318ee860bc3610184b615b4aa","assignee":{"login":"darrenleeweber","id":240623,"avatar_url":"https://avatars.githubusercontent.com/u/240623?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenleeweber","html_url":"https://github.com/darrenleeweber","followers_url":"https://api.github.com/users/darrenleeweber/followers","following_url":"https://api.github.com/users/darrenleeweber/following{/other_user}","gists_url":"https://api.github.com/users/darrenleeweber/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenleeweber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenleeweber/subscriptions","organizations_url":"https://api.github.com/users/darrenleeweber/orgs","repos_url":"https://api.github.com/users/darrenleeweber/repos","events_url":"https://api.github.com/users/darrenleeweber/events{/privacy}","received_events_url":"https://api.github.com/users/darrenleeweber/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/sul-dlss/argo/pulls/585/commits","review_comments_url":"https://api.github.com/repos/sul-dlss/argo/pulls/585/comments","review_comment_url":"https://api.github.com/repos/sul-dlss/argo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sul-dlss/argo/issues/585/comments","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/43eeb555bb483459d93e6eca5586db7b03c6ff95","head":{"label":"sul-dlss:enhance-user-permissions","ref":"enhance-user-permissions","sha":"43eeb555bb483459d93e6eca5586db7b03c6ff95","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989164,"name":"argo","full_name":"sul-dlss/argo","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/argo","description":"The administrative discovery interface for Stanford's Digital Object Registry","fork":false,"url":"https://api.github.com/repos/sul-dlss/argo","forks_url":"https://api.github.com/repos/sul-dlss/argo/forks","keys_url":"https://api.github.com/repos/sul-dlss/argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/argo/teams","hooks_url":"https://api.github.com/repos/sul-dlss/argo/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/argo/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/argo/events","assignees_url":"https://api.github.com/repos/sul-dlss/argo/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/argo/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/argo/tags","blobs_url":"https://api.github.com/repos/sul-dlss/argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/argo/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/argo/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/argo/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/argo/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/argo/subscription","commits_url":"https://api.github.com/repos/sul-dlss/argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/argo/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/argo/merges","archive_url":"https://api.github.com/repos/sul-dlss/argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/argo/downloads","issues_url":"https://api.github.com/repos/sul-dlss/argo/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/argo/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/argo/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/argo/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/argo/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/argo/deployments","created_at":"2012-07-11T13:15:05Z","updated_at":"2016-01-12T22:48:20Z","pushed_at":"2016-02-25T16:33:09Z","git_url":"git://github.com/sul-dlss/argo.git","ssh_url":"git@github.com:sul-dlss/argo.git","clone_url":"https://github.com/sul-dlss/argo.git","svn_url":"https://github.com/sul-dlss/argo","homepage":null,"size":29955,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":108,"forks":1,"open_issues":108,"watchers":12,"default_branch":"master"}},"base":{"label":"sul-dlss:develop","ref":"develop","sha":"5eab174243e163151556289dddfbb5caad5a196d","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989164,"name":"argo","full_name":"sul-dlss/argo","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/argo","description":"The administrative discovery interface for Stanford's Digital Object Registry","fork":false,"url":"https://api.github.com/repos/sul-dlss/argo","forks_url":"https://api.github.com/repos/sul-dlss/argo/forks","keys_url":"https://api.github.com/repos/sul-dlss/argo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/argo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/argo/teams","hooks_url":"https://api.github.com/repos/sul-dlss/argo/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/argo/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/argo/events","assignees_url":"https://api.github.com/repos/sul-dlss/argo/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/argo/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/argo/tags","blobs_url":"https://api.github.com/repos/sul-dlss/argo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/argo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/argo/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/argo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/argo/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/argo/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/argo/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/argo/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/argo/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/argo/subscription","commits_url":"https://api.github.com/repos/sul-dlss/argo/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/argo/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/argo/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/argo/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/argo/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/argo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/argo/merges","archive_url":"https://api.github.com/repos/sul-dlss/argo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/argo/downloads","issues_url":"https://api.github.com/repos/sul-dlss/argo/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/argo/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/argo/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/argo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/argo/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/argo/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/argo/deployments","created_at":"2012-07-11T13:15:05Z","updated_at":"2016-01-12T22:48:20Z","pushed_at":"2016-02-25T16:33:09Z","git_url":"git://github.com/sul-dlss/argo.git","ssh_url":"git@github.com:sul-dlss/argo.git","clone_url":"https://github.com/sul-dlss/argo.git","svn_url":"https://github.com/sul-dlss/argo","homepage":null,"size":29955,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":108,"forks":1,"open_issues":108,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/585"},"html":{"href":"https://github.com/sul-dlss/argo/pull/585"},"issue":{"href":"https://api.github.com/repos/sul-dlss/argo/issues/585"},"comments":{"href":"https://api.github.com/repos/sul-dlss/argo/issues/585/comments"},"review_comments":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/585/comments"},"review_comment":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sul-dlss/argo/pulls/585/commits"},"statuses":{"href":"https://api.github.com/repos/sul-dlss/argo/statuses/43eeb555bb483459d93e6eca5586db7b03c6ff95"}}}}