{"action":"created","issue":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3919","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3919/labels{/name}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3919/comments","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3919/events","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3919","id":98827954,"number":3919,"title":"[Ready for Review] Registration Approvals","user":{"login":"samchrisinger","id":2207561,"avatar_url":"https://avatars.githubusercontent.com/u/2207561?v=3","gravatar_id":"","url":"https://api.github.com/users/samchrisinger","html_url":"https://github.com/samchrisinger","followers_url":"https://api.github.com/users/samchrisinger/followers","following_url":"https://api.github.com/users/samchrisinger/following{/other_user}","gists_url":"https://api.github.com/users/samchrisinger/gists{/gist_id}","starred_url":"https://api.github.com/users/samchrisinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samchrisinger/subscriptions","organizations_url":"https://api.github.com/users/samchrisinger/orgs","repos_url":"https://api.github.com/users/samchrisinger/repos","events_url":"https://api.github.com/users/samchrisinger/events{/privacy}","received_events_url":"https://api.github.com/users/samchrisinger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels/Epic:%20Jun-Aug","name":"Epic: Jun-Aug","color":"00dd00"}],"state":"open","locked":false,"assignee":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/46","html_url":"https://github.com/CenterForOpenScience/osf.io/milestones/0.47.0","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/46/labels","id":1259756,"number":46,"title":"0.47.0","description":"","creator":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":2,"state":"open","created_at":"2015-08-18T02:50:36Z","updated_at":"2015-08-18T18:43:55Z","due_on":null,"closed_at":null},"comments":45,"created_at":"2015-08-03T20:02:16Z","updated_at":"2015-08-19T14:31:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3919","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3919","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/3919.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/3919.patch"},"body":"_[Associated Proposal](https://docs.google.com/document/d/1_zOgOvbAphIuj2A3L2Hg0rXP83xxAzCc0uAKRIF0bIs/edit#heading=h.4mazeeocviis)_\r\n\r\n# Purpose\r\n\r\nCommunity has requested that (to match the embargo behavior) all registrations require approval by administrators.  \r\n\r\nThere was already some (backend) redundancy with how embargoes and retractions were handled and a future need for generalized approval behavior (Prereg), so this seemed like an opportune time to generalize some of our infrastructure while simultaneously adding the requested registration approval behavior.\r\n\r\n# Changes\r\n\r\n- Add Sanction class as a generic representation of a stateful approval of some action\r\n- Add EmailApprovableSanction to generalize email-specific behavior shared by Embargo, Retraction\r\n- Add RegistrationApproval as a subclass of EmailApprovableSanction \r\n- Update embargo/retraction/registration views to use this new abstraction\r\n- Update Archiver to use new abstraction\r\n- Fix old tests\r\n- Add new tests for Sanction and EmailApprovableSanction\r\n\r\n# Side Effects\r\n\r\nThis touches Embargoes and Retractions. I'm confident in the quality of the unit tests in place as well as the newly added tests, but we should confirm that this functionally still works as expected. \r\n\r\nAdditionally now any time a project is registered and the associated archival task completes that registration will remain private until approved, or after they remain unapproved for 48 hours. An approval email is sent to every project admin, and a notification email is sent to every non-admin collaborator. This functionality mirrors Embargoes/Retractions as closely as possible. \r\n\r\nWe have also added logs for:\r\n- registration initiated\r\n- registration approved\r\n- registration rejected\r\n\r\n## New UI:\r\nNew flashed message after creating a registration:\r\n![screen shot 2015-08-07 at 3 52 44 pm](https://cloud.githubusercontent.com/assets/2207561/9144666/6da631c0-3d1c-11e5-8b47-00d773ec604a.png)\r\n\r\n\"Pending Registration\" indicator:\r\n![screen shot 2015-08-07 at 3 55 28 pm](https://cloud.githubusercontent.com/assets/2207561/9144722/caac5ec6-3d1c-11e5-99a4-617f36b437e3.png)\r\n\r\nFlashed message when visiting a registration that is pending approval:\r\n![screen shot 2015-08-07 at 3 56 30 pm](https://cloud.githubusercontent.com/assets/2207561/9144740/ef21a2a2-3d1c-11e5-96f7-6e203347a988.png)\r\n\r\n\"Pending registration\" email (if initator):\r\n```\r\nFrom: openscienceframework-noreply@osf.io\r\nSubject: Registration pending for one of your projects.\r\nMessage: Hello Samuel,\r\n\r\nYou initiated a registration of your project Fresh. The pending registration can be viewed here: http://localhost:5000/dt7wr/.\r\n\r\nTo approve this registration, click the following link: http://localhost:5000/project/dt7wr/registration/approve/pHqXvMEmZ93OL22caVg2uCVkgnnZl0/\r\n\r\nTo immediately cancel this registration, click the following link: http://localhost:5000/project/dt7wr/registration/disapprove/FktG1KHxkEKKbG0kKmklTJL7qu86wY/\r\n\r\nNote: If you take no action within 48, the registration will be automatically approved. This operation is irreversible.\r\n\r\nSincerely yours,\r\n\r\nThe OSF Robots\r\n```\r\n\"Pending registration\" email (non-initiator):\r\n```\r\nFrom: openscienceframework-noreply@osf.io\r\nSubject: Registration pending for one of your projects.\r\nMessage: Hello Samuel,\r\n\r\nSamuel has initiated a registration of your project Fresh. The pending registration can be viewed here: http://localhost:5000/dt7wr/.\r\n\r\nTo approve this registration, click the following link: http://localhost:5000/project/dt7wr/registration/approve/pHqXvMEmZ93OL22caVg2uCVkgnnZl0/\r\n\r\nTo immediately cancel this registration, click the following link: http://localhost:5000/project/dt7wr/registration/disapprove/FktG1KHxkEKKbG0kKmklTJL7qu86wY/\r\n\r\nNote: If you take no action within 48, the registration will be automatically approved. This operation is irreversible.\r\n\r\nSincerely yours,\r\n\r\nThe OSF Robots\r\n```\r\n\r\n\"Pending registration\" email non-admin\"\r\n```\r\nHello Samuel,\r\n\r\nWe just wanted to let you know that John Doe has initiated the following pending registration: http://localhost:5000/dt7wr/.\r\n\r\nSincerely yours,\r\n\r\nThe OSF Robots\r\n```\r\n\r\n\r\n\r\nTODOs\r\n\r\n- [x] Implement generic approval class\r\n- [x] Make Embargo and Retraction subclasses of generic approval class\r\n- [x] Implement RegistrationApproval class\r\n- [x] Implement views to support registration approvals\r\n- [x] Add registration approval logs and log templates\r\n  - [x] add tests for new logs and log templates\r\n- [x] Add registration approval email templates\r\n- [x] Fix the tests\r\n- [x] Add tests for new code\r\n- [x] Add cron scripts for auto-approval of registrations\r\n- [x] @HarryRybacki add pending_registration_approval to Node serialization and to mako templates"},"comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments/132620072","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3919#issuecomment-132620072","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3919","id":132620072,"user":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T14:31:26Z","updated_at":"2015-08-19T14:31:26Z","body":"Pass finished. Once the final changes are made, this is good to merge. :cocktail: "}}