{"action":"created","issue":{"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/1172","repository_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share","labels_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/1172/labels{/name}","comments_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/1172/comments","events_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/1172/events","html_url":"https://github.com/EUDAT-B2SHARE/b2share/issues/1172","id":185070696,"number":1172,"title":"api: validate record's REST API PATCH and PUT inputs","user":{"login":"nharraud","id":5708796,"avatar_url":"https://avatars.githubusercontent.com/u/5708796?v=3","gravatar_id":"","url":"https://api.github.com/users/nharraud","html_url":"https://github.com/nharraud","followers_url":"https://api.github.com/users/nharraud/followers","following_url":"https://api.github.com/users/nharraud/following{/other_user}","gists_url":"https://api.github.com/users/nharraud/gists{/gist_id}","starred_url":"https://api.github.com/users/nharraud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nharraud/subscriptions","organizations_url":"https://api.github.com/users/nharraud/orgs","repos_url":"https://api.github.com/users/nharraud/repos","events_url":"https://api.github.com/users/nharraud/events{/privacy}","received_events_url":"https://api.github.com/users/nharraud/received_events","type":"User","site_admin":false},"labels":[{"id":26712612,"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/labels/Enhancement","name":"Enhancement","color":"84b6eb","default":false},{"id":89459948,"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/labels/Important","name":"Important","color":"e11d21","default":false},{"id":418062543,"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/labels/Size:%20hard","name":"Size: hard","color":"a020f0","default":false},{"id":70324669,"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/labels/Urgent","name":"Urgent","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":{"login":"nharraud","id":5708796,"avatar_url":"https://avatars.githubusercontent.com/u/5708796?v=3","gravatar_id":"","url":"https://api.github.com/users/nharraud","html_url":"https://github.com/nharraud","followers_url":"https://api.github.com/users/nharraud/followers","following_url":"https://api.github.com/users/nharraud/following{/other_user}","gists_url":"https://api.github.com/users/nharraud/gists{/gist_id}","starred_url":"https://api.github.com/users/nharraud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nharraud/subscriptions","organizations_url":"https://api.github.com/users/nharraud/orgs","repos_url":"https://api.github.com/users/nharraud/repos","events_url":"https://api.github.com/users/nharraud/events{/privacy}","received_events_url":"https://api.github.com/users/nharraud/received_events","type":"User","site_admin":false},"assignees":[{"login":"nharraud","id":5708796,"avatar_url":"https://avatars.githubusercontent.com/u/5708796?v=3","gravatar_id":"","url":"https://api.github.com/users/nharraud","html_url":"https://github.com/nharraud","followers_url":"https://api.github.com/users/nharraud/followers","following_url":"https://api.github.com/users/nharraud/following{/other_user}","gists_url":"https://api.github.com/users/nharraud/gists{/gist_id}","starred_url":"https://api.github.com/users/nharraud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nharraud/subscriptions","organizations_url":"https://api.github.com/users/nharraud/orgs","repos_url":"https://api.github.com/users/nharraud/repos","events_url":"https://api.github.com/users/nharraud/events{/privacy}","received_events_url":"https://api.github.com/users/nharraud/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/milestones/43","html_url":"https://github.com/EUDAT-B2SHARE/b2share/milestone/43","labels_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/milestones/43/labels","id":2186414,"number":43,"title":" v2-RC12","description":"","creator":{"login":"emanueldima","id":231453,"avatar_url":"https://avatars.githubusercontent.com/u/231453?v=3","gravatar_id":"","url":"https://api.github.com/users/emanueldima","html_url":"https://github.com/emanueldima","followers_url":"https://api.github.com/users/emanueldima/followers","following_url":"https://api.github.com/users/emanueldima/following{/other_user}","gists_url":"https://api.github.com/users/emanueldima/gists{/gist_id}","starred_url":"https://api.github.com/users/emanueldima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanueldima/subscriptions","organizations_url":"https://api.github.com/users/emanueldima/orgs","repos_url":"https://api.github.com/users/emanueldima/repos","events_url":"https://api.github.com/users/emanueldima/events{/privacy}","received_events_url":"https://api.github.com/users/emanueldima/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":4,"state":"open","created_at":"2016-12-09T11:24:48Z","updated_at":"2016-12-19T09:18:20Z","due_on":"2016-12-22T00:00:00Z","closed_at":null},"comments":2,"created_at":"2016-10-25T09:56:20Z","updated_at":"2016-12-19T09:39:04Z","closed_at":null,"body":"**Problem:**\r\nA record's JSON Schema can only check the resulting record structure and values. It does not check what if a modification is allowed.\r\nWe need to add some mechanism to forbid changes.\r\n\r\nHere is an incomplete list of modifications which should not be allowed for a `draft`:\r\n- [x] change the 'publication_state' to an invalid state\r\n  - [x] change from `draft` to `published` or `submitted` when the community workflow does not allow it.\r\n  - [x] change to invalid values. This currently already handled by the root JSON Schema but should be moved somewhere else if communities need to create completely custom workflows.\r\n- [x] the community ID of a record should never be modified. Its schema depends on it.\r\n- [x] internal fields should not be modified from outside. Those fields include:\r\n  - `_pid`\r\n  - `_files`\r\n  - `_oai`\r\n  - `_deposit`\r\n  - `version`\r\n- [ ] inconsistent `embargo_date` and `open_access`. But this could be handled by the JSON Schema. This is currently automatically fixed, but a 400 error should be instead sent when a user explicitly asks for `open_access = True` and `embargo_date` in the future.\r\n\r\nA published record has all the same constraint except for `publication_state` which should always be `published`.\r\n"},"comment":{"url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/comments/267921117","html_url":"https://github.com/EUDAT-B2SHARE/b2share/issues/1172#issuecomment-267921117","issue_url":"https://api.github.com/repos/EUDAT-B2SHARE/b2share/issues/1172","id":267921117,"user":{"login":"nharraud","id":5708796,"avatar_url":"https://avatars.githubusercontent.com/u/5708796?v=3","gravatar_id":"","url":"https://api.github.com/users/nharraud","html_url":"https://github.com/nharraud","followers_url":"https://api.github.com/users/nharraud/followers","following_url":"https://api.github.com/users/nharraud/following{/other_user}","gists_url":"https://api.github.com/users/nharraud/gists{/gist_id}","starred_url":"https://api.github.com/users/nharraud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nharraud/subscriptions","organizations_url":"https://api.github.com/users/nharraud/orgs","repos_url":"https://api.github.com/users/nharraud/repos","events_url":"https://api.github.com/users/nharraud/events{/privacy}","received_events_url":"https://api.github.com/users/nharraud/received_events","type":"User","site_admin":false},"created_at":"2016-12-19T09:39:04Z","updated_at":"2016-12-19T09:39:04Z","body":"@emanueldima Just the last one could be improved. Removing urgent tag."}}
{"actor":{"display_login":"nharraud"}}