{"action":"created","comment":{"url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/comments/107954616","pull_request_review_id":28961160,"id":107954616,"diff_hunk":"@@ -58,6 +61,45 @@ def license_handler(request, course, ccx=None):\n     return HttpResponseBadRequest('Only GET and POST methods are supported.')\n \n \n+class LicensedSimulationsUpdateView(APIView):\n+    \"\"\"\n+    Labster License update handlers.\n+    \"\"\"\n+    authentication_classes = (TokenAuthentication,)\n+    permission_classes = (IsAdminUser,)\n+\n+    def post(self, request):\n+        \"\"\"\n+        Update course license with new simulations list.\n+        \"\"\"\n+        license_code = request.data.get('name')\n+\n+        try:\n+            course_license = CourseLicense.objects.get(license_code=license_code)\n+        except CourseLicense.DoesNotExist:\n+            return Response(\n+                {\"error\": \"License %s not found.\" % license_code},\n+                status=status.HTTP_400_BAD_REQUEST\n+            )\n+\n+        ccx_id = course_license.course_id.ccx\n+        ccx = CustomCourseForEdX.objects.get(pk=ccx_id)","path":"lms/djangoapps/labster_course_license/views.py","position":61,"original_position":61,"commit_id":"a9b80fea7bc7da4db609a6657926db5ae9e45f2b","original_commit_id":"a9b80fea7bc7da4db609a6657926db5ae9e45f2b","user":{"login":"polesye","id":1247491,"avatar_url":"https://avatars3.githubusercontent.com/u/1247491?v=3","gravatar_id":"","url":"https://api.github.com/users/polesye","html_url":"https://github.com/polesye","followers_url":"https://api.github.com/users/polesye/followers","following_url":"https://api.github.com/users/polesye/following{/other_user}","gists_url":"https://api.github.com/users/polesye/gists{/gist_id}","starred_url":"https://api.github.com/users/polesye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polesye/subscriptions","organizations_url":"https://api.github.com/users/polesye/orgs","repos_url":"https://api.github.com/users/polesye/repos","events_url":"https://api.github.com/users/polesye/events{/privacy}","received_events_url":"https://api.github.com/users/polesye/received_events","type":"User","site_admin":false},"body":"Are you sure the course exists?\r\nWhat if it has been removed? In this case, course_license is still exist.","created_at":"2017-03-24T17:14:15Z","updated_at":"2017-03-24T17:14:15Z","html_url":"https://github.com/Livit/Livit.Learn.EdX/pull/67#discussion_r107954616","pull_request_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/comments/107954616"},"html":{"href":"https://github.com/Livit/Livit.Learn.EdX/pull/67#discussion_r107954616"},"pull_request":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67","id":108227486,"html_url":"https://github.com/Livit/Livit.Learn.EdX/pull/67","diff_url":"https://github.com/Livit/Livit.Learn.EdX/pull/67.diff","patch_url":"https://github.com/Livit/Livit.Learn.EdX/pull/67.patch","issue_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/67","number":67,"state":"open","locked":false,"title":"WEB-727 Show only licensed simulations","user":{"login":"TamoshaytisV","id":5970883,"avatar_url":"https://avatars3.githubusercontent.com/u/5970883?v=3","gravatar_id":"","url":"https://api.github.com/users/TamoshaytisV","html_url":"https://github.com/TamoshaytisV","followers_url":"https://api.github.com/users/TamoshaytisV/followers","following_url":"https://api.github.com/users/TamoshaytisV/following{/other_user}","gists_url":"https://api.github.com/users/TamoshaytisV/gists{/gist_id}","starred_url":"https://api.github.com/users/TamoshaytisV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TamoshaytisV/subscriptions","organizations_url":"https://api.github.com/users/TamoshaytisV/orgs","repos_url":"https://api.github.com/users/TamoshaytisV/repos","events_url":"https://api.github.com/users/TamoshaytisV/events{/privacy}","received_events_url":"https://api.github.com/users/TamoshaytisV/received_events","type":"User","site_admin":false},"body":"This PR is a result of the approach to change existing logic of processing courseware items visibility.\r\n\r\n## Problem description\r\nCurrently, we have an issue with newly added master course (MC) content. Every added extra simulation will appear in every CCX course derived from MC even if it is not present in the license. The current workaround is to reapply licenses for every CCX course which can be very irritating.\r\n\r\n## PR implementation idea\r\nWhen license is applied, we store info about the course: list of licensed simulations from API for course (licensed sims cache), store licensed simulations per every courseware block. Write custom override provider that will return `visible_to_staff_only` property value `True` if no licensed simulations in block and no another not licensed content (html, problem, overview), otherwise `False`.\r\nCatch `course_published signal` and update saved course access info according to course licensed simulations chache (no additional API requests).","created_at":"2017-02-27T23:44:50Z","updated_at":"2017-03-24T17:14:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68bf1db13c7aa6d6eb67a68a7d17ba6639cc7951","assignee":{"login":"TamoshaytisV","id":5970883,"avatar_url":"https://avatars3.githubusercontent.com/u/5970883?v=3","gravatar_id":"","url":"https://api.github.com/users/TamoshaytisV","html_url":"https://github.com/TamoshaytisV","followers_url":"https://api.github.com/users/TamoshaytisV/followers","following_url":"https://api.github.com/users/TamoshaytisV/following{/other_user}","gists_url":"https://api.github.com/users/TamoshaytisV/gists{/gist_id}","starred_url":"https://api.github.com/users/TamoshaytisV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TamoshaytisV/subscriptions","organizations_url":"https://api.github.com/users/TamoshaytisV/orgs","repos_url":"https://api.github.com/users/TamoshaytisV/repos","events_url":"https://api.github.com/users/TamoshaytisV/events{/privacy}","received_events_url":"https://api.github.com/users/TamoshaytisV/received_events","type":"User","site_admin":false},"assignees":[{"login":"TamoshaytisV","id":5970883,"avatar_url":"https://avatars3.githubusercontent.com/u/5970883?v=3","gravatar_id":"","url":"https://api.github.com/users/TamoshaytisV","html_url":"https://github.com/TamoshaytisV","followers_url":"https://api.github.com/users/TamoshaytisV/followers","following_url":"https://api.github.com/users/TamoshaytisV/following{/other_user}","gists_url":"https://api.github.com/users/TamoshaytisV/gists{/gist_id}","starred_url":"https://api.github.com/users/TamoshaytisV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TamoshaytisV/subscriptions","organizations_url":"https://api.github.com/users/TamoshaytisV/orgs","repos_url":"https://api.github.com/users/TamoshaytisV/repos","events_url":"https://api.github.com/users/TamoshaytisV/events{/privacy}","received_events_url":"https://api.github.com/users/TamoshaytisV/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67/commits","review_comments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67/comments","review_comment_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/67/comments","statuses_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/statuses/a9b80fea7bc7da4db609a6657926db5ae9e45f2b","head":{"label":"Livit:fix/show_only_license_simulations","ref":"fix/show_only_license_simulations","sha":"a9b80fea7bc7da4db609a6657926db5ae9e45f2b","user":{"login":"Livit","id":9495033,"avatar_url":"https://avatars2.githubusercontent.com/u/9495033?v=3","gravatar_id":"","url":"https://api.github.com/users/Livit","html_url":"https://github.com/Livit","followers_url":"https://api.github.com/users/Livit/followers","following_url":"https://api.github.com/users/Livit/following{/other_user}","gists_url":"https://api.github.com/users/Livit/gists{/gist_id}","starred_url":"https://api.github.com/users/Livit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livit/subscriptions","organizations_url":"https://api.github.com/users/Livit/orgs","repos_url":"https://api.github.com/users/Livit/repos","events_url":"https://api.github.com/users/Livit/events{/privacy}","received_events_url":"https://api.github.com/users/Livit/received_events","type":"Organization","site_admin":false},"repo":{"id":14646304,"name":"Livit.Learn.EdX","full_name":"Livit/Livit.Learn.EdX","owner":{"login":"Livit","id":9495033,"avatar_url":"https://avatars2.githubusercontent.com/u/9495033?v=3","gravatar_id":"","url":"https://api.github.com/users/Livit","html_url":"https://github.com/Livit","followers_url":"https://api.github.com/users/Livit/followers","following_url":"https://api.github.com/users/Livit/following{/other_user}","gists_url":"https://api.github.com/users/Livit/gists{/gist_id}","starred_url":"https://api.github.com/users/Livit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livit/subscriptions","organizations_url":"https://api.github.com/users/Livit/orgs","repos_url":"https://api.github.com/users/Livit/repos","events_url":"https://api.github.com/users/Livit/events{/privacy}","received_events_url":"https://api.github.com/users/Livit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Livit/Livit.Learn.EdX","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Livit/Livit.Learn.EdX","forks_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/forks","keys_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/teams","hooks_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/hooks","issue_events_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/events{/number}","events_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/events","assignees_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/assignees{/user}","branches_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/branches{/branch}","tags_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/tags","blobs_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/refs{/sha}","trees_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/statuses/{sha}","languages_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/languages","stargazers_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/stargazers","contributors_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/contributors","subscribers_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/subscribers","subscription_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/subscription","commits_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/commits{/sha}","git_commits_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/commits{/sha}","comments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/comments{/number}","issue_comment_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/comments{/number}","contents_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/contents/{+path}","compare_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/merges","archive_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/downloads","issues_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues{/number}","pulls_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls{/number}","milestones_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/milestones{/number}","notifications_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/labels{/name}","releases_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/releases{/id}","deployments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/deployments","created_at":"2013-11-23T16:54:25Z","updated_at":"2017-03-15T07:54:38Z","pushed_at":"2017-03-23T20:49:21Z","git_url":"git://github.com/Livit/Livit.Learn.EdX.git","ssh_url":"git@github.com:Livit/Livit.Learn.EdX.git","clone_url":"https://github.com/Livit/Livit.Learn.EdX.git","svn_url":"https://github.com/Livit/Livit.Learn.EdX","homepage":"http://code.edx.org/","size":695695,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":8,"default_branch":"labster/develop"}},"base":{"label":"Livit:labster/develop","ref":"labster/develop","sha":"5e6e30ee237d53a6e6d89c14d0bba5fb8b9ec95e","user":{"login":"Livit","id":9495033,"avatar_url":"https://avatars2.githubusercontent.com/u/9495033?v=3","gravatar_id":"","url":"https://api.github.com/users/Livit","html_url":"https://github.com/Livit","followers_url":"https://api.github.com/users/Livit/followers","following_url":"https://api.github.com/users/Livit/following{/other_user}","gists_url":"https://api.github.com/users/Livit/gists{/gist_id}","starred_url":"https://api.github.com/users/Livit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livit/subscriptions","organizations_url":"https://api.github.com/users/Livit/orgs","repos_url":"https://api.github.com/users/Livit/repos","events_url":"https://api.github.com/users/Livit/events{/privacy}","received_events_url":"https://api.github.com/users/Livit/received_events","type":"Organization","site_admin":false},"repo":{"id":14646304,"name":"Livit.Learn.EdX","full_name":"Livit/Livit.Learn.EdX","owner":{"login":"Livit","id":9495033,"avatar_url":"https://avatars2.githubusercontent.com/u/9495033?v=3","gravatar_id":"","url":"https://api.github.com/users/Livit","html_url":"https://github.com/Livit","followers_url":"https://api.github.com/users/Livit/followers","following_url":"https://api.github.com/users/Livit/following{/other_user}","gists_url":"https://api.github.com/users/Livit/gists{/gist_id}","starred_url":"https://api.github.com/users/Livit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Livit/subscriptions","organizations_url":"https://api.github.com/users/Livit/orgs","repos_url":"https://api.github.com/users/Livit/repos","events_url":"https://api.github.com/users/Livit/events{/privacy}","received_events_url":"https://api.github.com/users/Livit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Livit/Livit.Learn.EdX","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Livit/Livit.Learn.EdX","forks_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/forks","keys_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/teams","hooks_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/hooks","issue_events_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/events{/number}","events_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/events","assignees_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/assignees{/user}","branches_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/branches{/branch}","tags_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/tags","blobs_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/refs{/sha}","trees_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/statuses/{sha}","languages_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/languages","stargazers_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/stargazers","contributors_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/contributors","subscribers_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/subscribers","subscription_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/subscription","commits_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/commits{/sha}","git_commits_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/git/commits{/sha}","comments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/comments{/number}","issue_comment_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/comments{/number}","contents_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/contents/{+path}","compare_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/merges","archive_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/downloads","issues_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues{/number}","pulls_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls{/number}","milestones_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/milestones{/number}","notifications_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/labels{/name}","releases_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/releases{/id}","deployments_url":"https://api.github.com/repos/Livit/Livit.Learn.EdX/deployments","created_at":"2013-11-23T16:54:25Z","updated_at":"2017-03-15T07:54:38Z","pushed_at":"2017-03-23T20:49:21Z","git_url":"git://github.com/Livit/Livit.Learn.EdX.git","ssh_url":"git@github.com:Livit/Livit.Learn.EdX.git","clone_url":"https://github.com/Livit/Livit.Learn.EdX.git","svn_url":"https://github.com/Livit/Livit.Learn.EdX","homepage":"http://code.edx.org/","size":695695,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":8,"default_branch":"labster/develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67"},"html":{"href":"https://github.com/Livit/Livit.Learn.EdX/pull/67"},"issue":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/67"},"comments":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/Livit/Livit.Learn.EdX/statuses/a9b80fea7bc7da4db609a6657926db5ae9e45f2b"}}}}
{"actor":{"display_login":"polesye"}}