{"action":"created","comment":{"url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/comments/59477839","id":59477839,"diff_hunk":"@@ -28,4 +32,51 @@\n       get :download_pdf, id: 1                            \n     end\n   end\n-end\n\\ No newline at end of file\n+\n+  describe \"GET /users/:id/edit\" do\n+    it \"should render the edit view for an admin user\" do\n+      sign_in admin\n+      get :edit, id: tenant\n+\n+      expect(response.status).to eq(200)\n+      expect(response).to render_template(\"edit\")\n+    end\n+\n+    it \"should redirect a non-admin user to the root path\" do\n+      sign_in tenant\n+      get :edit, id: tenant\n+\n+      expect(response).to redirect_to(root_path)\n+\n+      sign_in lawyer\n+      get :edit, id: tenant\n+\n+      expect(response).to redirect_to(root_path)\n+    end\n+  end\n+\n+  describe \"GET /users/:id/update\" do\n+    let(:params) { { id: tenant, user: { first_name: \"Updated\" } } }\n+\n+    it \"should update the resource if the request comes from an admin user\" do\n+      admin.collaborations.create(collaborator: tenant)","path":"spec/controllers/users_controller_spec.rb","position":44,"original_position":44,"commit_id":"f8e8b46870782570e6a2eea7fa036687fc33006b","original_commit_id":"f8e8b46870782570e6a2eea7fa036687fc33006b","user":{"login":"ramillim","id":3946035,"avatar_url":"https://avatars.githubusercontent.com/u/3946035?v=3","gravatar_id":"","url":"https://api.github.com/users/ramillim","html_url":"https://github.com/ramillim","followers_url":"https://api.github.com/users/ramillim/followers","following_url":"https://api.github.com/users/ramillim/following{/other_user}","gists_url":"https://api.github.com/users/ramillim/gists{/gist_id}","starred_url":"https://api.github.com/users/ramillim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramillim/subscriptions","organizations_url":"https://api.github.com/users/ramillim/orgs","repos_url":"https://api.github.com/users/ramillim/repos","events_url":"https://api.github.com/users/ramillim/events{/privacy}","received_events_url":"https://api.github.com/users/ramillim/received_events","type":"User","site_admin":false},"body":"Oh in that case, should the edit action also be checking that you are in the User's collaborations association even for admins? Was the intent to allow the lawyer permission set to be able to access the edit page to if it had a collaboration. I had assumed that it was admin only because the form allowed you to set the User's permission level to admin, lawyer, or tenant.","created_at":"2016-04-13T00:40:48Z","updated_at":"2016-04-13T00:40:48Z","html_url":"https://github.com/heatseeknyc/heatseeknyc/pull/140#discussion_r59477839","pull_request_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140","_links":{"self":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/comments/59477839"},"html":{"href":"https://github.com/heatseeknyc/heatseeknyc/pull/140#discussion_r59477839"},"pull_request":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140"}}},"pull_request":{"url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140","id":65932947,"html_url":"https://github.com/heatseeknyc/heatseeknyc/pull/140","diff_url":"https://github.com/heatseeknyc/heatseeknyc/pull/140.diff","patch_url":"https://github.com/heatseeknyc/heatseeknyc/pull/140.patch","issue_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/140","number":140,"state":"closed","locked":false,"title":"Make Users controller edit and update admin only","user":{"login":"ramillim","id":3946035,"avatar_url":"https://avatars.githubusercontent.com/u/3946035?v=3","gravatar_id":"","url":"https://api.github.com/users/ramillim","html_url":"https://github.com/ramillim","followers_url":"https://api.github.com/users/ramillim/followers","following_url":"https://api.github.com/users/ramillim/following{/other_user}","gists_url":"https://api.github.com/users/ramillim/gists{/gist_id}","starred_url":"https://api.github.com/users/ramillim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramillim/subscriptions","organizations_url":"https://api.github.com/users/ramillim/orgs","repos_url":"https://api.github.com/users/ramillim/repos","events_url":"https://api.github.com/users/ramillim/events{/privacy}","received_events_url":"https://api.github.com/users/ramillim/received_events","type":"User","site_admin":false},"body":"@williamcodes Fixes the bug I mentioned at the last meeting.\r\n\r\nUpdating the permissions logic in the controller made me think that the permission logic should be moved to the Users model so the controller could simply check something like\r\n```ruby\r\nif current_user.is_admin?\r\n...\r\nif current_user.is_admin? || current_user.is_lawyer?\r\n```\r\nI think there should be a new issue to refactor those permission sets.\r\n\r\n","created_at":"2016-04-11T02:21:44Z","updated_at":"2016-04-13T00:40:48Z","closed_at":"2016-04-12T20:43:22Z","merged_at":"2016-04-12T20:43:22Z","merge_commit_sha":"99353a58e67146dbcac2f51ba277c65d5d133206","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140/commits","review_comments_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140/comments","review_comment_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/140/comments","statuses_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/statuses/f8e8b46870782570e6a2eea7fa036687fc33006b","head":{"label":"ramillim:users-edit-route-permissions","ref":"users-edit-route-permissions","sha":"f8e8b46870782570e6a2eea7fa036687fc33006b","user":{"login":"ramillim","id":3946035,"avatar_url":"https://avatars.githubusercontent.com/u/3946035?v=3","gravatar_id":"","url":"https://api.github.com/users/ramillim","html_url":"https://github.com/ramillim","followers_url":"https://api.github.com/users/ramillim/followers","following_url":"https://api.github.com/users/ramillim/following{/other_user}","gists_url":"https://api.github.com/users/ramillim/gists{/gist_id}","starred_url":"https://api.github.com/users/ramillim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramillim/subscriptions","organizations_url":"https://api.github.com/users/ramillim/orgs","repos_url":"https://api.github.com/users/ramillim/repos","events_url":"https://api.github.com/users/ramillim/events{/privacy}","received_events_url":"https://api.github.com/users/ramillim/received_events","type":"User","site_admin":false},"repo":{"id":53607248,"name":"heatseeknyc","full_name":"ramillim/heatseeknyc","owner":{"login":"ramillim","id":3946035,"avatar_url":"https://avatars.githubusercontent.com/u/3946035?v=3","gravatar_id":"","url":"https://api.github.com/users/ramillim","html_url":"https://github.com/ramillim","followers_url":"https://api.github.com/users/ramillim/followers","following_url":"https://api.github.com/users/ramillim/following{/other_user}","gists_url":"https://api.github.com/users/ramillim/gists{/gist_id}","starred_url":"https://api.github.com/users/ramillim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramillim/subscriptions","organizations_url":"https://api.github.com/users/ramillim/orgs","repos_url":"https://api.github.com/users/ramillim/repos","events_url":"https://api.github.com/users/ramillim/events{/privacy}","received_events_url":"https://api.github.com/users/ramillim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ramillim/heatseeknyc","description":"HeatSeekNYC -- a web-enabled hardware platform to detect heating violations in NYC","fork":true,"url":"https://api.github.com/repos/ramillim/heatseeknyc","forks_url":"https://api.github.com/repos/ramillim/heatseeknyc/forks","keys_url":"https://api.github.com/repos/ramillim/heatseeknyc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramillim/heatseeknyc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramillim/heatseeknyc/teams","hooks_url":"https://api.github.com/repos/ramillim/heatseeknyc/hooks","issue_events_url":"https://api.github.com/repos/ramillim/heatseeknyc/issues/events{/number}","events_url":"https://api.github.com/repos/ramillim/heatseeknyc/events","assignees_url":"https://api.github.com/repos/ramillim/heatseeknyc/assignees{/user}","branches_url":"https://api.github.com/repos/ramillim/heatseeknyc/branches{/branch}","tags_url":"https://api.github.com/repos/ramillim/heatseeknyc/tags","blobs_url":"https://api.github.com/repos/ramillim/heatseeknyc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramillim/heatseeknyc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramillim/heatseeknyc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramillim/heatseeknyc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramillim/heatseeknyc/statuses/{sha}","languages_url":"https://api.github.com/repos/ramillim/heatseeknyc/languages","stargazers_url":"https://api.github.com/repos/ramillim/heatseeknyc/stargazers","contributors_url":"https://api.github.com/repos/ramillim/heatseeknyc/contributors","subscribers_url":"https://api.github.com/repos/ramillim/heatseeknyc/subscribers","subscription_url":"https://api.github.com/repos/ramillim/heatseeknyc/subscription","commits_url":"https://api.github.com/repos/ramillim/heatseeknyc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramillim/heatseeknyc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramillim/heatseeknyc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramillim/heatseeknyc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramillim/heatseeknyc/contents/{+path}","compare_url":"https://api.github.com/repos/ramillim/heatseeknyc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramillim/heatseeknyc/merges","archive_url":"https://api.github.com/repos/ramillim/heatseeknyc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramillim/heatseeknyc/downloads","issues_url":"https://api.github.com/repos/ramillim/heatseeknyc/issues{/number}","pulls_url":"https://api.github.com/repos/ramillim/heatseeknyc/pulls{/number}","milestones_url":"https://api.github.com/repos/ramillim/heatseeknyc/milestones{/number}","notifications_url":"https://api.github.com/repos/ramillim/heatseeknyc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramillim/heatseeknyc/labels{/name}","releases_url":"https://api.github.com/repos/ramillim/heatseeknyc/releases{/id}","deployments_url":"https://api.github.com/repos/ramillim/heatseeknyc/deployments","created_at":"2016-03-10T18:26:09Z","updated_at":"2016-03-10T18:26:10Z","pushed_at":"2016-04-11T02:16:41Z","git_url":"git://github.com/ramillim/heatseeknyc.git","ssh_url":"git@github.com:ramillim/heatseeknyc.git","clone_url":"https://github.com/ramillim/heatseeknyc.git","svn_url":"https://github.com/ramillim/heatseeknyc","homepage":"http://heatseeknyc.com/","size":124244,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"heatseeknyc:master","ref":"master","sha":"f53507503b05df171b0ab906b4cf07ec91ef44c4","user":{"login":"heatseeknyc","id":7570070,"avatar_url":"https://avatars.githubusercontent.com/u/7570070?v=3","gravatar_id":"","url":"https://api.github.com/users/heatseeknyc","html_url":"https://github.com/heatseeknyc","followers_url":"https://api.github.com/users/heatseeknyc/followers","following_url":"https://api.github.com/users/heatseeknyc/following{/other_user}","gists_url":"https://api.github.com/users/heatseeknyc/gists{/gist_id}","starred_url":"https://api.github.com/users/heatseeknyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heatseeknyc/subscriptions","organizations_url":"https://api.github.com/users/heatseeknyc/orgs","repos_url":"https://api.github.com/users/heatseeknyc/repos","events_url":"https://api.github.com/users/heatseeknyc/events{/privacy}","received_events_url":"https://api.github.com/users/heatseeknyc/received_events","type":"Organization","site_admin":false},"repo":{"id":17613188,"name":"heatseeknyc","full_name":"heatseeknyc/heatseeknyc","owner":{"login":"heatseeknyc","id":7570070,"avatar_url":"https://avatars.githubusercontent.com/u/7570070?v=3","gravatar_id":"","url":"https://api.github.com/users/heatseeknyc","html_url":"https://github.com/heatseeknyc","followers_url":"https://api.github.com/users/heatseeknyc/followers","following_url":"https://api.github.com/users/heatseeknyc/following{/other_user}","gists_url":"https://api.github.com/users/heatseeknyc/gists{/gist_id}","starred_url":"https://api.github.com/users/heatseeknyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heatseeknyc/subscriptions","organizations_url":"https://api.github.com/users/heatseeknyc/orgs","repos_url":"https://api.github.com/users/heatseeknyc/repos","events_url":"https://api.github.com/users/heatseeknyc/events{/privacy}","received_events_url":"https://api.github.com/users/heatseeknyc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/heatseeknyc/heatseeknyc","description":"HeatSeekNYC -- a web-enabled hardware platform to detect heating violations in NYC","fork":false,"url":"https://api.github.com/repos/heatseeknyc/heatseeknyc","forks_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/forks","keys_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/teams","hooks_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/hooks","issue_events_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/events{/number}","events_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/events","assignees_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/assignees{/user}","branches_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/branches{/branch}","tags_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/tags","blobs_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/git/refs{/sha}","trees_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/statuses/{sha}","languages_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/languages","stargazers_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/stargazers","contributors_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/contributors","subscribers_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/subscribers","subscription_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/subscription","commits_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/commits{/sha}","git_commits_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/git/commits{/sha}","comments_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/comments{/number}","issue_comment_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/comments{/number}","contents_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/contents/{+path}","compare_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/merges","archive_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/downloads","issues_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues{/number}","pulls_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls{/number}","milestones_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/milestones{/number}","notifications_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/labels{/name}","releases_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/releases{/id}","deployments_url":"https://api.github.com/repos/heatseeknyc/heatseeknyc/deployments","created_at":"2014-03-11T00:18:22Z","updated_at":"2016-03-09T17:27:55Z","pushed_at":"2016-04-12T22:28:29Z","git_url":"git://github.com/heatseeknyc/heatseeknyc.git","ssh_url":"git@github.com:heatseeknyc/heatseeknyc.git","clone_url":"https://github.com/heatseeknyc/heatseeknyc.git","svn_url":"https://github.com/heatseeknyc/heatseeknyc","homepage":"http://heatseeknyc.com/","size":124418,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":42,"forks":12,"open_issues":42,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140"},"html":{"href":"https://github.com/heatseeknyc/heatseeknyc/pull/140"},"issue":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/140"},"comments":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/issues/140/comments"},"review_comments":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140/comments"},"review_comment":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/pulls/140/commits"},"statuses":{"href":"https://api.github.com/repos/heatseeknyc/heatseeknyc/statuses/f8e8b46870782570e6a2eea7fa036687fc33006b"}}}}