{"action":"created","comment":{"url":"https://api.github.com/repos/mirumee/saleor/pulls/comments/181661252","pull_request_review_id":112321170,"id":181661252,"diff_hunk":"@@ -0,0 +1,16 @@\n+from functools import wraps\n+\n+from django.shortcuts import get_object_or_404\n+\n+from ...page.models import Page\n+from .modals import modal_protected_page\n+\n+\n+def unprotected_page_required(view):","path":"saleor/dashboard/page/decorators.py","position":9,"original_position":9,"commit_id":"e68ed88659d3371ae2d4ddf6fd578baf6556c391","original_commit_id":"e68ed88659d3371ae2d4ddf6fd578baf6556c391","user":{"login":"elwoodxblues","id":5421321,"avatar_url":"https://avatars1.githubusercontent.com/u/5421321?v=4","gravatar_id":"","url":"https://api.github.com/users/elwoodxblues","html_url":"https://github.com/elwoodxblues","followers_url":"https://api.github.com/users/elwoodxblues/followers","following_url":"https://api.github.com/users/elwoodxblues/following{/other_user}","gists_url":"https://api.github.com/users/elwoodxblues/gists{/gist_id}","starred_url":"https://api.github.com/users/elwoodxblues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elwoodxblues/subscriptions","organizations_url":"https://api.github.com/users/elwoodxblues/orgs","repos_url":"https://api.github.com/users/elwoodxblues/repos","events_url":"https://api.github.com/users/elwoodxblues/events{/privacy}","received_events_url":"https://api.github.com/users/elwoodxblues/received_events","type":"User","site_admin":false},"body":"Do we really need the decorator for that purpose? In case of `page_delete` view we could check `page.is_protected` in the view. We could consider adding such decorator when we have more views requiring it.","created_at":"2018-04-16T08:44:41Z","updated_at":"2018-04-16T09:04:10Z","html_url":"https://github.com/mirumee/saleor/pull/2038#discussion_r181661252","pull_request_url":"https://api.github.com/repos/mirumee/saleor/pulls/2038","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/comments/181661252"},"html":{"href":"https://github.com/mirumee/saleor/pull/2038#discussion_r181661252"},"pull_request":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/2038"}}},"pull_request":{"url":"https://api.github.com/repos/mirumee/saleor/pulls/2038","id":179457798,"html_url":"https://github.com/mirumee/saleor/pull/2038","diff_url":"https://github.com/mirumee/saleor/pull/2038.diff","patch_url":"https://github.com/mirumee/saleor/pull/2038.patch","issue_url":"https://api.github.com/repos/mirumee/saleor/issues/2038","number":2038,"state":"open","locked":false,"title":"Protected pages & Selling contract + Privacy pages","user":{"login":"NyanKiyoshi","id":6186720,"avatar_url":"https://avatars0.githubusercontent.com/u/6186720?v=4","gravatar_id":"","url":"https://api.github.com/users/NyanKiyoshi","html_url":"https://github.com/NyanKiyoshi","followers_url":"https://api.github.com/users/NyanKiyoshi/followers","following_url":"https://api.github.com/users/NyanKiyoshi/following{/other_user}","gists_url":"https://api.github.com/users/NyanKiyoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/NyanKiyoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NyanKiyoshi/subscriptions","organizations_url":"https://api.github.com/users/NyanKiyoshi/orgs","repos_url":"https://api.github.com/users/NyanKiyoshi/repos","events_url":"https://api.github.com/users/NyanKiyoshi/events{/privacy}","received_events_url":"https://api.github.com/users/NyanKiyoshi/received_events","type":"User","site_admin":false},"body":"This PR has for goal to implement the suggestions of #2022 and close #2022. Closing this PR will also make both #2020 and #2021 ready for merge (after review)—Edit: I may have to do a few edits to #2020 and #2021 when this PR will be merged.\r\n\r\n### Details\r\n- This PR introduce a new, and temporary mechanism of page protection. Which means, nobody can delete it from dashboard (not even the super user), to avoid any breaking in dependencies;\r\n- It will also generate a privacy and selling contract page(s) on migration and on populate db (which will check for existing page).\r\n\r\nThen, will be dropped with a better solution later on, depending how it will be decided to proceed and to implement it.\r\n\r\n### Page protection\r\n- The PR adds a new settings key named `PROTECTED_PAGES`, which contains page `slugs`;\r\n- It also adds a new property `is_protected` to the `Page` model which returns `True` if the slug is in `PROTECTED_PAGES`;\r\n- The view responsible for the page deletion in dashboard return an error modal if the page is protected. Note, I didn't decide to hide the 'Remove button' as the user may wonder why the page doesn't have one;\r\n- The page form disables the slug field if the page is flagged as protected, which blocks any bypassing or inadvertent changes/ breakings.\r\n\r\n\r\n### Todo\r\n- [x] Implement the checks in GraphQL;\r\n- [x] Add tests;\r\n- [x] Generate privacy and selling contract page(s);\r\n- [x] Generate from migrations;\r\n- [x] Document the changes;\r\n\r\n### Pull Request Checklist\r\n\r\n(Please keep this section. It will make maintainer's life easier.)\r\n\r\n1. [x] Privileged views and APIs are guarded by proper permission checks.\r\n1. [x] All visible strings are translated with proper context.\r\n1. [x] All data-formatting is locale-aware (dates, numbers, and so on).\r\n1. [x] Database queries are optimized and the number of queries is constant.\r\n1. [x] The changes are tested.\r\n1. [x] The code is documented (docstrings, project documentation).\r\n1. [x] Python code quality checks pass: `pycodestyle`, `pydocstyle`, `pylint`.\r\n1. [x] JavaScript code quality checks pass: `eslint`.\r\n","created_at":"2018-04-04T17:19:08Z","updated_at":"2018-04-16T09:04:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab0e34af9c6777afc826503ea6f83102e3d0f566","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mirumee/saleor/pulls/2038/commits","review_comments_url":"https://api.github.com/repos/mirumee/saleor/pulls/2038/comments","review_comment_url":"https://api.github.com/repos/mirumee/saleor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mirumee/saleor/issues/2038/comments","statuses_url":"https://api.github.com/repos/mirumee/saleor/statuses/e68ed88659d3371ae2d4ddf6fd578baf6556c391","head":{"label":"NyanKiyoshi:protected-pages/privacy-page","ref":"protected-pages/privacy-page","sha":"e68ed88659d3371ae2d4ddf6fd578baf6556c391","user":{"login":"NyanKiyoshi","id":6186720,"avatar_url":"https://avatars0.githubusercontent.com/u/6186720?v=4","gravatar_id":"","url":"https://api.github.com/users/NyanKiyoshi","html_url":"https://github.com/NyanKiyoshi","followers_url":"https://api.github.com/users/NyanKiyoshi/followers","following_url":"https://api.github.com/users/NyanKiyoshi/following{/other_user}","gists_url":"https://api.github.com/users/NyanKiyoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/NyanKiyoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NyanKiyoshi/subscriptions","organizations_url":"https://api.github.com/users/NyanKiyoshi/orgs","repos_url":"https://api.github.com/users/NyanKiyoshi/repos","events_url":"https://api.github.com/users/NyanKiyoshi/events{/privacy}","received_events_url":"https://api.github.com/users/NyanKiyoshi/received_events","type":"User","site_admin":false},"repo":{"id":119869137,"name":"saleor","full_name":"NyanKiyoshi/saleor","owner":{"login":"NyanKiyoshi","id":6186720,"avatar_url":"https://avatars0.githubusercontent.com/u/6186720?v=4","gravatar_id":"","url":"https://api.github.com/users/NyanKiyoshi","html_url":"https://github.com/NyanKiyoshi","followers_url":"https://api.github.com/users/NyanKiyoshi/followers","following_url":"https://api.github.com/users/NyanKiyoshi/following{/other_user}","gists_url":"https://api.github.com/users/NyanKiyoshi/gists{/gist_id}","starred_url":"https://api.github.com/users/NyanKiyoshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NyanKiyoshi/subscriptions","organizations_url":"https://api.github.com/users/NyanKiyoshi/orgs","repos_url":"https://api.github.com/users/NyanKiyoshi/repos","events_url":"https://api.github.com/users/NyanKiyoshi/events{/privacy}","received_events_url":"https://api.github.com/users/NyanKiyoshi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NyanKiyoshi/saleor","description":"An e-commerce storefront for Python and Django","fork":true,"url":"https://api.github.com/repos/NyanKiyoshi/saleor","forks_url":"https://api.github.com/repos/NyanKiyoshi/saleor/forks","keys_url":"https://api.github.com/repos/NyanKiyoshi/saleor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NyanKiyoshi/saleor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NyanKiyoshi/saleor/teams","hooks_url":"https://api.github.com/repos/NyanKiyoshi/saleor/hooks","issue_events_url":"https://api.github.com/repos/NyanKiyoshi/saleor/issues/events{/number}","events_url":"https://api.github.com/repos/NyanKiyoshi/saleor/events","assignees_url":"https://api.github.com/repos/NyanKiyoshi/saleor/assignees{/user}","branches_url":"https://api.github.com/repos/NyanKiyoshi/saleor/branches{/branch}","tags_url":"https://api.github.com/repos/NyanKiyoshi/saleor/tags","blobs_url":"https://api.github.com/repos/NyanKiyoshi/saleor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NyanKiyoshi/saleor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NyanKiyoshi/saleor/git/refs{/sha}","trees_url":"https://api.github.com/repos/NyanKiyoshi/saleor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NyanKiyoshi/saleor/statuses/{sha}","languages_url":"https://api.github.com/repos/NyanKiyoshi/saleor/languages","stargazers_url":"https://api.github.com/repos/NyanKiyoshi/saleor/stargazers","contributors_url":"https://api.github.com/repos/NyanKiyoshi/saleor/contributors","subscribers_url":"https://api.github.com/repos/NyanKiyoshi/saleor/subscribers","subscription_url":"https://api.github.com/repos/NyanKiyoshi/saleor/subscription","commits_url":"https://api.github.com/repos/NyanKiyoshi/saleor/commits{/sha}","git_commits_url":"https://api.github.com/repos/NyanKiyoshi/saleor/git/commits{/sha}","comments_url":"https://api.github.com/repos/NyanKiyoshi/saleor/comments{/number}","issue_comment_url":"https://api.github.com/repos/NyanKiyoshi/saleor/issues/comments{/number}","contents_url":"https://api.github.com/repos/NyanKiyoshi/saleor/contents/{+path}","compare_url":"https://api.github.com/repos/NyanKiyoshi/saleor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NyanKiyoshi/saleor/merges","archive_url":"https://api.github.com/repos/NyanKiyoshi/saleor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NyanKiyoshi/saleor/downloads","issues_url":"https://api.github.com/repos/NyanKiyoshi/saleor/issues{/number}","pulls_url":"https://api.github.com/repos/NyanKiyoshi/saleor/pulls{/number}","milestones_url":"https://api.github.com/repos/NyanKiyoshi/saleor/milestones{/number}","notifications_url":"https://api.github.com/repos/NyanKiyoshi/saleor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NyanKiyoshi/saleor/labels{/name}","releases_url":"https://api.github.com/repos/NyanKiyoshi/saleor/releases{/id}","deployments_url":"https://api.github.com/repos/NyanKiyoshi/saleor/deployments","created_at":"2018-02-01T17:25:18Z","updated_at":"2018-04-04T15:58:03Z","pushed_at":"2018-04-15T15:16:58Z","git_url":"git://github.com/NyanKiyoshi/saleor.git","ssh_url":"git@github.com:NyanKiyoshi/saleor.git","clone_url":"https://github.com/NyanKiyoshi/saleor.git","svn_url":"https://github.com/NyanKiyoshi/saleor","homepage":"http://getsaleor.com","size":28212,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mirumee:master","ref":"master","sha":"99390b1851ff93e4a519e8bb2cbbf7439c47f24e","user":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"repo":{"id":8162715,"name":"saleor","full_name":"mirumee/saleor","owner":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mirumee/saleor","description":"An e-commerce storefront for Python and Django","fork":false,"url":"https://api.github.com/repos/mirumee/saleor","forks_url":"https://api.github.com/repos/mirumee/saleor/forks","keys_url":"https://api.github.com/repos/mirumee/saleor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mirumee/saleor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mirumee/saleor/teams","hooks_url":"https://api.github.com/repos/mirumee/saleor/hooks","issue_events_url":"https://api.github.com/repos/mirumee/saleor/issues/events{/number}","events_url":"https://api.github.com/repos/mirumee/saleor/events","assignees_url":"https://api.github.com/repos/mirumee/saleor/assignees{/user}","branches_url":"https://api.github.com/repos/mirumee/saleor/branches{/branch}","tags_url":"https://api.github.com/repos/mirumee/saleor/tags","blobs_url":"https://api.github.com/repos/mirumee/saleor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mirumee/saleor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mirumee/saleor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mirumee/saleor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mirumee/saleor/statuses/{sha}","languages_url":"https://api.github.com/repos/mirumee/saleor/languages","stargazers_url":"https://api.github.com/repos/mirumee/saleor/stargazers","contributors_url":"https://api.github.com/repos/mirumee/saleor/contributors","subscribers_url":"https://api.github.com/repos/mirumee/saleor/subscribers","subscription_url":"https://api.github.com/repos/mirumee/saleor/subscription","commits_url":"https://api.github.com/repos/mirumee/saleor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mirumee/saleor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mirumee/saleor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mirumee/saleor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mirumee/saleor/contents/{+path}","compare_url":"https://api.github.com/repos/mirumee/saleor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mirumee/saleor/merges","archive_url":"https://api.github.com/repos/mirumee/saleor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mirumee/saleor/downloads","issues_url":"https://api.github.com/repos/mirumee/saleor/issues{/number}","pulls_url":"https://api.github.com/repos/mirumee/saleor/pulls{/number}","milestones_url":"https://api.github.com/repos/mirumee/saleor/milestones{/number}","notifications_url":"https://api.github.com/repos/mirumee/saleor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mirumee/saleor/labels{/name}","releases_url":"https://api.github.com/repos/mirumee/saleor/releases{/id}","deployments_url":"https://api.github.com/repos/mirumee/saleor/deployments","created_at":"2013-02-12T16:46:39Z","updated_at":"2018-04-16T07:28:04Z","pushed_at":"2018-04-16T04:01:04Z","git_url":"git://github.com/mirumee/saleor.git","ssh_url":"git@github.com:mirumee/saleor.git","clone_url":"https://github.com/mirumee/saleor.git","svn_url":"https://github.com/mirumee/saleor","homepage":"http://getsaleor.com","size":42332,"stargazers_count":1833,"watchers_count":1833,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":864,"mirror_url":null,"archived":false,"open_issues_count":191,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":864,"open_issues":191,"watchers":1833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/2038"},"html":{"href":"https://github.com/mirumee/saleor/pull/2038"},"issue":{"href":"https://api.github.com/repos/mirumee/saleor/issues/2038"},"comments":{"href":"https://api.github.com/repos/mirumee/saleor/issues/2038/comments"},"review_comments":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/2038/comments"},"review_comment":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/2038/commits"},"statuses":{"href":"https://api.github.com/repos/mirumee/saleor/statuses/e68ed88659d3371ae2d4ddf6fd578baf6556c391"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"elwoodxblues"}}