{"action":"opened","number":135,"pull_request":{"url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135","id":93496268,"html_url":"https://github.com/empowerhack/DrawMyLife-Service/pull/135","diff_url":"https://github.com/empowerhack/DrawMyLife-Service/pull/135.diff","patch_url":"https://github.com/empowerhack/DrawMyLife-Service/pull/135.patch","issue_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/135","number":135,"state":"open","locked":false,"title":"[95] Disable self-signup, add roles and user management system","user":{"login":"krissy","id":574526,"avatar_url":"https://avatars.githubusercontent.com/u/574526?v=3","gravatar_id":"","url":"https://api.github.com/users/krissy","html_url":"https://github.com/krissy","followers_url":"https://api.github.com/users/krissy/followers","following_url":"https://api.github.com/users/krissy/following{/other_user}","gists_url":"https://api.github.com/users/krissy/gists{/gist_id}","starred_url":"https://api.github.com/users/krissy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krissy/subscriptions","organizations_url":"https://api.github.com/users/krissy/orgs","repos_url":"https://api.github.com/users/krissy/repos","events_url":"https://api.github.com/users/krissy/events{/privacy}","received_events_url":"https://api.github.com/users/krissy/received_events","type":"User","site_admin":false},"body":"#### Addresses issue: #95 \r\n\r\n***Progress: 95%***\r\n\r\n:eyes: Reviewers: though there's one outstanding task to setup mail for all the environments, this is definitely due code review asap! Please see \"What This Could Have\" section below for things that are known to need improvement / fixing but will be made into post-pilot tickets. Also, there was a lot of hacky stuff we had to do to get around Devise so I'd say don't worry _too much_ about the stuff in `controllers/profiles` and `views/profiles` which hold a bunch of community-suggested overrides to get things working. \r\n\r\n## What this does\r\n- [x] Remove public self-signup page\r\n- [x] Set up roles assignment:`admin, org_admin, super_admin`. Currently, only application is super_admin ability to manage users.\r\n- [x] Add user management section to add, edit, delete users (available to super_admins)\r\n- [x] Configure sign-up process: super_admin creates new user details (with no password), email is sent to user to confirm email and set their own password as part of activation process (see [Screenshots](#Screenshots) below for flow)\r\n- [x] Configure re-confirmation on email change process: similar to above\r\n- [x] Add individual Organisation view pages linked to from user details\r\n- [x] Create a load of custom [Devise](https://github.com/plataformatec/devise) overrides to make authentication work the way we wan it, and cater for a whole lot of edge cases and different scenarios depending on who is modifying user details and in what context (e.g. confirmation, own user profile, user management pages). \r\n- [ ] Update email config for staging and live environments (see [Deploy Instructions](#deploy-instructions) below for mail setup info)\r\n\r\n## What this could have (if time permitted)\r\n\r\nNB: These aren't blocking enough to be done before second pilot but noting here as they should be addressed eventually and be translated into tickets\r\n\r\n- [ ] UX / Frontend love for user management system and related email layouts sent for email confirmation, password re-send, etc\r\n- [ ] Much better test coverage\r\n- [ ] Role assignment for org_admins as per business rules in ticket, and a sweep over the platform to see what else should have conditional access applied\r\n\r\n## Deploy instructions\r\n\r\n### Mail: \r\nNB: There is still a task to configure our staging and live mail servers as per the above checklist. Details on each of these:\r\n\r\nOn our Heroku Staging instance, we've installed the add-on [Mailtrap](https://devcenter.heroku.com/articles/mailtrap), a dummy SMTP server that will catch all our emails instead of sending them out into the real world. \r\n\r\nOn our production instance, we've installed the add-on for the [SendGrid](https://devcenter.heroku.com/articles/sendgrid) email service.\r\n\r\n### Deployment\r\n- Run migrations:\r\n  - db/migrate/20161009225419_add_role_to_users.rb\r\n  - db/migrate/20161030193401_add_confirmable_to_devise.rb\r\n- Push the button\r\n- Manually update any users to super_admin in console: e.g. `your_user.role = 'super_admin; your_user.save!`\r\n\r\n\r\n## Screenshots\r\n\r\n### Flow:\r\n\r\n#### User Management section (accessible by super_admin only)\r\n\r\n<img width=\"1222\" alt=\"screen shot 2016-11-14 at 00 54 33\" src=\"https://cloud.githubusercontent.com/assets/574526/20250354/f5924b58-aa05-11e6-9df9-1dc10d51e38f.png\">\r\n\r\n#### Edit Existing User\r\n\r\n<img width=\"1203\" alt=\"screen shot 2016-11-14 at 00 54 59\" src=\"https://cloud.githubusercontent.com/assets/574526/20250368/160ef1f6-aa06-11e6-9d44-a7e1c8571b43.png\">\r\n\r\n\r\n#### Add New User\r\n\r\n<img width=\"1235\" alt=\"screen shot 2016-11-14 at 01 01 06\" src=\"https://cloud.githubusercontent.com/assets/574526/20250387/3718fa22-aa06-11e6-9905-48ca91c21419.png\">\r\n\r\n<img width=\"831\" alt=\"screen shot 2016-11-14 at 01 01 27\" src=\"https://cloud.githubusercontent.com/assets/574526/20250396/40355628-aa06-11e6-81bc-d43817d0e7d2.png\">\r\n\r\n\r\n#### Confirmation/Activation\r\n\r\n<img width=\"877\" alt=\"screen shot 2016-11-14 at 00 58 59\" src=\"https://cloud.githubusercontent.com/assets/574526/20250403/50bd557c-aa06-11e6-8626-dcd6a0b5735d.png\">\r\n\r\n<img width=\"1222\" alt=\"screen shot 2016-11-14 at 00 59 51\" src=\"https://cloud.githubusercontent.com/assets/574526/20250410/696d273c-aa06-11e6-919e-e4d8f54d0cc1.png\">\r\n\r\n(User activated and auto-logged in)\r\n\r\n<img width=\"1163\" alt=\"screen shot 2016-11-14 at 01 00 09\" src=\"https://cloud.githubusercontent.com/assets/574526/20250416/6f45ae22-aa06-11e6-9ec0-68ac27fea224.png\">\r\n\r\n","created_at":"2016-11-14T01:20:36Z","updated_at":"2016-11-14T01:20:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4f51bc01141ae49384db6fd80c22df849831473","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135/commits","review_comments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135/comments","review_comment_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/135/comments","statuses_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/statuses/047d0d1196c973418d21575349f6ad120ddd885b","head":{"label":"empowerhack:95-user-roles-authorize","ref":"95-user-roles-authorize","sha":"047d0d1196c973418d21575349f6ad120ddd885b","user":{"login":"empowerhack","id":15375901,"avatar_url":"https://avatars.githubusercontent.com/u/15375901?v=3","gravatar_id":"","url":"https://api.github.com/users/empowerhack","html_url":"https://github.com/empowerhack","followers_url":"https://api.github.com/users/empowerhack/followers","following_url":"https://api.github.com/users/empowerhack/following{/other_user}","gists_url":"https://api.github.com/users/empowerhack/gists{/gist_id}","starred_url":"https://api.github.com/users/empowerhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empowerhack/subscriptions","organizations_url":"https://api.github.com/users/empowerhack/orgs","repos_url":"https://api.github.com/users/empowerhack/repos","events_url":"https://api.github.com/users/empowerhack/events{/privacy}","received_events_url":"https://api.github.com/users/empowerhack/received_events","type":"Organization","site_admin":false},"repo":{"id":55846492,"name":"DrawMyLife-Service","full_name":"empowerhack/DrawMyLife-Service","owner":{"login":"empowerhack","id":15375901,"avatar_url":"https://avatars.githubusercontent.com/u/15375901?v=3","gravatar_id":"","url":"https://api.github.com/users/empowerhack","html_url":"https://github.com/empowerhack","followers_url":"https://api.github.com/users/empowerhack/followers","following_url":"https://api.github.com/users/empowerhack/following{/other_user}","gists_url":"https://api.github.com/users/empowerhack/gists{/gist_id}","starred_url":"https://api.github.com/users/empowerhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empowerhack/subscriptions","organizations_url":"https://api.github.com/users/empowerhack/orgs","repos_url":"https://api.github.com/users/empowerhack/repos","events_url":"https://api.github.com/users/empowerhack/events{/privacy}","received_events_url":"https://api.github.com/users/empowerhack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/empowerhack/DrawMyLife-Service","description":"API and Admin system for the Draw My Life initiative (in partnership with EmpowerHack and Terre Des Hommes)","fork":false,"url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service","forks_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/forks","keys_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/teams","hooks_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/hooks","issue_events_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/events{/number}","events_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/events","assignees_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/assignees{/user}","branches_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/branches{/branch}","tags_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/tags","blobs_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/refs{/sha}","trees_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/statuses/{sha}","languages_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/languages","stargazers_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/stargazers","contributors_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/contributors","subscribers_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/subscribers","subscription_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/subscription","commits_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/commits{/sha}","git_commits_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/commits{/sha}","comments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/comments{/number}","issue_comment_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/comments{/number}","contents_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/contents/{+path}","compare_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/merges","archive_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/downloads","issues_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues{/number}","pulls_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls{/number}","milestones_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/milestones{/number}","notifications_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/labels{/name}","releases_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/releases{/id}","deployments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/deployments","created_at":"2016-04-09T13:44:34Z","updated_at":"2016-10-30T18:25:51Z","pushed_at":"2016-11-14T01:20:36Z","git_url":"git://github.com/empowerhack/DrawMyLife-Service.git","ssh_url":"git@github.com:empowerhack/DrawMyLife-Service.git","clone_url":"https://github.com/empowerhack/DrawMyLife-Service.git","svn_url":"https://github.com/empowerhack/DrawMyLife-Service","homepage":"","size":2043,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":32,"forks":0,"open_issues":32,"watchers":12,"default_branch":"master"}},"base":{"label":"empowerhack:master","ref":"master","sha":"757c7038ac736cf92778c8e9aabf4206669dac6c","user":{"login":"empowerhack","id":15375901,"avatar_url":"https://avatars.githubusercontent.com/u/15375901?v=3","gravatar_id":"","url":"https://api.github.com/users/empowerhack","html_url":"https://github.com/empowerhack","followers_url":"https://api.github.com/users/empowerhack/followers","following_url":"https://api.github.com/users/empowerhack/following{/other_user}","gists_url":"https://api.github.com/users/empowerhack/gists{/gist_id}","starred_url":"https://api.github.com/users/empowerhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empowerhack/subscriptions","organizations_url":"https://api.github.com/users/empowerhack/orgs","repos_url":"https://api.github.com/users/empowerhack/repos","events_url":"https://api.github.com/users/empowerhack/events{/privacy}","received_events_url":"https://api.github.com/users/empowerhack/received_events","type":"Organization","site_admin":false},"repo":{"id":55846492,"name":"DrawMyLife-Service","full_name":"empowerhack/DrawMyLife-Service","owner":{"login":"empowerhack","id":15375901,"avatar_url":"https://avatars.githubusercontent.com/u/15375901?v=3","gravatar_id":"","url":"https://api.github.com/users/empowerhack","html_url":"https://github.com/empowerhack","followers_url":"https://api.github.com/users/empowerhack/followers","following_url":"https://api.github.com/users/empowerhack/following{/other_user}","gists_url":"https://api.github.com/users/empowerhack/gists{/gist_id}","starred_url":"https://api.github.com/users/empowerhack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/empowerhack/subscriptions","organizations_url":"https://api.github.com/users/empowerhack/orgs","repos_url":"https://api.github.com/users/empowerhack/repos","events_url":"https://api.github.com/users/empowerhack/events{/privacy}","received_events_url":"https://api.github.com/users/empowerhack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/empowerhack/DrawMyLife-Service","description":"API and Admin system for the Draw My Life initiative (in partnership with EmpowerHack and Terre Des Hommes)","fork":false,"url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service","forks_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/forks","keys_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/teams","hooks_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/hooks","issue_events_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/events{/number}","events_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/events","assignees_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/assignees{/user}","branches_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/branches{/branch}","tags_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/tags","blobs_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/refs{/sha}","trees_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/statuses/{sha}","languages_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/languages","stargazers_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/stargazers","contributors_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/contributors","subscribers_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/subscribers","subscription_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/subscription","commits_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/commits{/sha}","git_commits_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/git/commits{/sha}","comments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/comments{/number}","issue_comment_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/comments{/number}","contents_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/contents/{+path}","compare_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/merges","archive_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/downloads","issues_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues{/number}","pulls_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls{/number}","milestones_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/milestones{/number}","notifications_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/labels{/name}","releases_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/releases{/id}","deployments_url":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/deployments","created_at":"2016-04-09T13:44:34Z","updated_at":"2016-10-30T18:25:51Z","pushed_at":"2016-11-14T01:20:36Z","git_url":"git://github.com/empowerhack/DrawMyLife-Service.git","ssh_url":"git@github.com:empowerhack/DrawMyLife-Service.git","clone_url":"https://github.com/empowerhack/DrawMyLife-Service.git","svn_url":"https://github.com/empowerhack/DrawMyLife-Service","homepage":"","size":2043,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":32,"forks":0,"open_issues":32,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135"},"html":{"href":"https://github.com/empowerhack/DrawMyLife-Service/pull/135"},"issue":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/135"},"comments":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/empowerhack/DrawMyLife-Service/statuses/047d0d1196c973418d21575349f6ad120ddd885b"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":8,"additions":865,"deletions":207,"changed_files":58}}
{"actor":{"display_login":"krissy"}}