{"action":"created","comment":{"url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/comments/205773205","pull_request_review_id":141111256,"id":205773205,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTc3MzIwNQ==","diff_hunk":"@@ -0,0 +1,178 @@\n+import json\n+import logging\n+import string\n+import random\n+\n+from django.core.exceptions import NON_FIELD_ERRORS, ValidationError\n+from django.contrib.auth.models import User\n+from rest_framework.views import APIView\n+from rest_framework import status\n+from rest_framework.response import Response\n+from util.disable_rate_limit import can_disable_rate_limit\n+from openedx.core.djangoapps.user_api.accounts.api import check_account_exists\n+from student.views import create_account_with_params\n+from student.models import CourseEnrollment, EnrollmentClosedError, \\","path":"lms/djangoapps/etc_api/views.py","position":14,"original_position":14,"commit_id":"68dfc631c06cbe9357ff1a4658f26f982ae94e0f","original_commit_id":"68dfc631c06cbe9357ff1a4658f26f982ae94e0f","user":{"login":"idegtiarov","id":7392821,"node_id":"MDQ6VXNlcjczOTI4MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/7392821?v=4","gravatar_id":"","url":"https://api.github.com/users/idegtiarov","html_url":"https://github.com/idegtiarov","followers_url":"https://api.github.com/users/idegtiarov/followers","following_url":"https://api.github.com/users/idegtiarov/following{/other_user}","gists_url":"https://api.github.com/users/idegtiarov/gists{/gist_id}","starred_url":"https://api.github.com/users/idegtiarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idegtiarov/subscriptions","organizations_url":"https://api.github.com/users/idegtiarov/orgs","repos_url":"https://api.github.com/users/idegtiarov/repos","events_url":"https://api.github.com/users/idegtiarov/events{/privacy}","received_events_url":"https://api.github.com/users/idegtiarov/received_events","type":"User","site_admin":false},"body":"Please take a look at edx code style guide!","created_at":"2018-07-27T13:32:09Z","updated_at":"2018-07-27T13:49:12Z","html_url":"https://github.com/raccoongang/edx-platform/pull/493#discussion_r205773205","pull_request_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/comments/205773205"},"html":{"href":"https://github.com/raccoongang/edx-platform/pull/493#discussion_r205773205"},"pull_request":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493"}}},"pull_request":{"url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493","id":204417636,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NDE3NjM2","html_url":"https://github.com/raccoongang/edx-platform/pull/493","diff_url":"https://github.com/raccoongang/edx-platform/pull/493.diff","patch_url":"https://github.com/raccoongang/edx-platform/pull/493.patch","issue_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/493","number":493,"state":"open","locked":false,"title":"Etc ficus create enroll api","user":{"login":"AndreyLykhoman","id":9655643,"node_id":"MDQ6VXNlcjk2NTU2NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/9655643?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreyLykhoman","html_url":"https://github.com/AndreyLykhoman","followers_url":"https://api.github.com/users/AndreyLykhoman/followers","following_url":"https://api.github.com/users/AndreyLykhoman/following{/other_user}","gists_url":"https://api.github.com/users/AndreyLykhoman/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyLykhoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyLykhoman/subscriptions","organizations_url":"https://api.github.com/users/AndreyLykhoman/orgs","repos_url":"https://api.github.com/users/AndreyLykhoman/repos","events_url":"https://api.github.com/users/AndreyLykhoman/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyLykhoman/received_events","type":"User","site_admin":false},"body":"**Description:**  Endpoints fo create user and enroll user. Also add endpoint for enable and disable users \r\n\r\nFor this task I used solving relates use used the workpiece. I configurated setting and wrote needed endpoints.\r\n\r\n**Youtrack:** https://youtrack.raccoongang.com/issue/ETC-11\r\n\r\n**Configuration instructions:** \r\nCode need next additional settings:\r\n\r\nadd to lms.auth.json 'EDX_APP_ETC_API_KEY'. It's key for check valid token.\r\nThe following token should be available in the python code: 'HTTP_X_APP_ETC_API_KEY'\r\nIn admin page for this sites add to site's setting: 'ENABLE_APP_ETC_API': true\r\n\r\n**Testing instructions:**\r\nendpoints: \r\n- 'api/user/create' - body { Prename, surname, email, username} - Response {user_id}\r\n\r\ncurl -X POST \\\r\n  http://localhost:8000/api/user/create \\\r\n  -H 'Cache-Control: no-cache' \\\r\n  -H 'Content-Type: application/json' \\\r\n  -H 'Postman-Token: c4ceae4c-7470-4dbc-bf61-79057e3dae71' \\\r\n  -H 'X-APP-ETC-API-KEY: 12345' \\\r\n  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \\\r\n  -F email=andrey.lykhoman12344566@raccoongang.com \\\r\n  -F username=andreylykhoman006 \\\r\n  -F prename=Andrey \\\r\n  -F surname=Lykhoman\r\n\r\n -'api/user/set/activate/status' - body {user_id, is_active} - Response {user_id, is_active}\r\ncurl -X POST \\\r\n  http://localhost:8000/api/user/set/activate/status \\\r\n  -H 'Cache-Control: no-cache' \\\r\n  -H 'Postman-Token: 0dac28e7-18a6-4b6c-9f74-fc53b90ebf7e' \\\r\n  -H 'X-APP-ETC-API-KEY: 12345' \\\r\n  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \\\r\n  -F user_id=21 \\\r\n  -F is_active=true\r\n\r\n\r\n - '/api/user/enrollment' - body {User_id, course_id, mode, is_active} - Response {enroll_id}\r\n\r\ncurl -X POST \\\r\n  http://localhost:8000/api/user/enrollment \\\r\n  -H 'Cache-Control: no-cache' \\\r\n  -H 'Content-Type: application/x-www-form-urlencoded' \\\r\n  -H 'Postman-Token: b86810e9-5644-416e-9331-8ea57e1679b7' \\\r\n  -H 'X-APP-ETC-API-KEY: 12345' \\\r\n  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \\\r\n  -F 'course_id=course-v1:edX+DemoX+Demo_Course' \\\r\n  -F user_id=21 \\\r\n  -F is_active=false \\\r\n  -F mode=honor\r\n","created_at":"2018-07-27T12:28:55Z","updated_at":"2018-07-27T13:49:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b164b20603fa080b489242eaa6be2d97d78b5084","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493/commits","review_comments_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493/comments","review_comment_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/493/comments","statuses_url":"https://api.github.com/repos/raccoongang/edx-platform/statuses/68dfc631c06cbe9357ff1a4658f26f982ae94e0f","head":{"label":"raccoongang:etc-ficus-create-enroll-api","ref":"etc-ficus-create-enroll-api","sha":"68dfc631c06cbe9357ff1a4658f26f982ae94e0f","user":{"login":"raccoongang","id":11388447,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzg4NDQ3","avatar_url":"https://avatars0.githubusercontent.com/u/11388447?v=4","gravatar_id":"","url":"https://api.github.com/users/raccoongang","html_url":"https://github.com/raccoongang","followers_url":"https://api.github.com/users/raccoongang/followers","following_url":"https://api.github.com/users/raccoongang/following{/other_user}","gists_url":"https://api.github.com/users/raccoongang/gists{/gist_id}","starred_url":"https://api.github.com/users/raccoongang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raccoongang/subscriptions","organizations_url":"https://api.github.com/users/raccoongang/orgs","repos_url":"https://api.github.com/users/raccoongang/repos","events_url":"https://api.github.com/users/raccoongang/events{/privacy}","received_events_url":"https://api.github.com/users/raccoongang/received_events","type":"Organization","site_admin":false},"repo":{"id":26811891,"node_id":"MDEwOlJlcG9zaXRvcnkyNjgxMTg5MQ==","name":"edx-platform","full_name":"raccoongang/edx-platform","owner":{"login":"raccoongang","id":11388447,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzg4NDQ3","avatar_url":"https://avatars0.githubusercontent.com/u/11388447?v=4","gravatar_id":"","url":"https://api.github.com/users/raccoongang","html_url":"https://github.com/raccoongang","followers_url":"https://api.github.com/users/raccoongang/followers","following_url":"https://api.github.com/users/raccoongang/following{/other_user}","gists_url":"https://api.github.com/users/raccoongang/gists{/gist_id}","starred_url":"https://api.github.com/users/raccoongang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raccoongang/subscriptions","organizations_url":"https://api.github.com/users/raccoongang/orgs","repos_url":"https://api.github.com/users/raccoongang/repos","events_url":"https://api.github.com/users/raccoongang/events{/privacy}","received_events_url":"https://api.github.com/users/raccoongang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raccoongang/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":true,"url":"https://api.github.com/repos/raccoongang/edx-platform","forks_url":"https://api.github.com/repos/raccoongang/edx-platform/forks","keys_url":"https://api.github.com/repos/raccoongang/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raccoongang/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raccoongang/edx-platform/teams","hooks_url":"https://api.github.com/repos/raccoongang/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/raccoongang/edx-platform/events","assignees_url":"https://api.github.com/repos/raccoongang/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/raccoongang/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/raccoongang/edx-platform/tags","blobs_url":"https://api.github.com/repos/raccoongang/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raccoongang/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raccoongang/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/raccoongang/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raccoongang/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/raccoongang/edx-platform/languages","stargazers_url":"https://api.github.com/repos/raccoongang/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/raccoongang/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/raccoongang/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/raccoongang/edx-platform/subscription","commits_url":"https://api.github.com/repos/raccoongang/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/raccoongang/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/raccoongang/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/raccoongang/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/raccoongang/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raccoongang/edx-platform/merges","archive_url":"https://api.github.com/repos/raccoongang/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raccoongang/edx-platform/downloads","issues_url":"https://api.github.com/repos/raccoongang/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/raccoongang/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/raccoongang/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raccoongang/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/raccoongang/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/raccoongang/edx-platform/deployments","created_at":"2014-11-18T14:05:58Z","updated_at":"2018-07-26T11:54:28Z","pushed_at":"2018-07-27T13:21:51Z","git_url":"git://github.com/raccoongang/edx-platform.git","ssh_url":"git@github.com:raccoongang/edx-platform.git","clone_url":"https://github.com/raccoongang/edx-platform.git","svn_url":"https://github.com/raccoongang/edx-platform","homepage":"http://openedx.org/","size":1067707,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":12,"open_issues":9,"watchers":9,"default_branch":"ginkgo-rg"}},"base":{"label":"raccoongang:etc-ficus-stage","ref":"etc-ficus-stage","sha":"6996afb66026dc5de4ec1808aba0faee4f2132cc","user":{"login":"raccoongang","id":11388447,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzg4NDQ3","avatar_url":"https://avatars0.githubusercontent.com/u/11388447?v=4","gravatar_id":"","url":"https://api.github.com/users/raccoongang","html_url":"https://github.com/raccoongang","followers_url":"https://api.github.com/users/raccoongang/followers","following_url":"https://api.github.com/users/raccoongang/following{/other_user}","gists_url":"https://api.github.com/users/raccoongang/gists{/gist_id}","starred_url":"https://api.github.com/users/raccoongang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raccoongang/subscriptions","organizations_url":"https://api.github.com/users/raccoongang/orgs","repos_url":"https://api.github.com/users/raccoongang/repos","events_url":"https://api.github.com/users/raccoongang/events{/privacy}","received_events_url":"https://api.github.com/users/raccoongang/received_events","type":"Organization","site_admin":false},"repo":{"id":26811891,"node_id":"MDEwOlJlcG9zaXRvcnkyNjgxMTg5MQ==","name":"edx-platform","full_name":"raccoongang/edx-platform","owner":{"login":"raccoongang","id":11388447,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzg4NDQ3","avatar_url":"https://avatars0.githubusercontent.com/u/11388447?v=4","gravatar_id":"","url":"https://api.github.com/users/raccoongang","html_url":"https://github.com/raccoongang","followers_url":"https://api.github.com/users/raccoongang/followers","following_url":"https://api.github.com/users/raccoongang/following{/other_user}","gists_url":"https://api.github.com/users/raccoongang/gists{/gist_id}","starred_url":"https://api.github.com/users/raccoongang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raccoongang/subscriptions","organizations_url":"https://api.github.com/users/raccoongang/orgs","repos_url":"https://api.github.com/users/raccoongang/repos","events_url":"https://api.github.com/users/raccoongang/events{/privacy}","received_events_url":"https://api.github.com/users/raccoongang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raccoongang/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":true,"url":"https://api.github.com/repos/raccoongang/edx-platform","forks_url":"https://api.github.com/repos/raccoongang/edx-platform/forks","keys_url":"https://api.github.com/repos/raccoongang/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raccoongang/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raccoongang/edx-platform/teams","hooks_url":"https://api.github.com/repos/raccoongang/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/raccoongang/edx-platform/events","assignees_url":"https://api.github.com/repos/raccoongang/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/raccoongang/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/raccoongang/edx-platform/tags","blobs_url":"https://api.github.com/repos/raccoongang/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raccoongang/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raccoongang/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/raccoongang/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raccoongang/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/raccoongang/edx-platform/languages","stargazers_url":"https://api.github.com/repos/raccoongang/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/raccoongang/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/raccoongang/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/raccoongang/edx-platform/subscription","commits_url":"https://api.github.com/repos/raccoongang/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/raccoongang/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/raccoongang/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/raccoongang/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/raccoongang/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/raccoongang/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raccoongang/edx-platform/merges","archive_url":"https://api.github.com/repos/raccoongang/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raccoongang/edx-platform/downloads","issues_url":"https://api.github.com/repos/raccoongang/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/raccoongang/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/raccoongang/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/raccoongang/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raccoongang/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/raccoongang/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/raccoongang/edx-platform/deployments","created_at":"2014-11-18T14:05:58Z","updated_at":"2018-07-26T11:54:28Z","pushed_at":"2018-07-27T13:21:51Z","git_url":"git://github.com/raccoongang/edx-platform.git","ssh_url":"git@github.com:raccoongang/edx-platform.git","clone_url":"https://github.com/raccoongang/edx-platform.git","svn_url":"https://github.com/raccoongang/edx-platform","homepage":"http://openedx.org/","size":1067707,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":12,"open_issues":9,"watchers":9,"default_branch":"ginkgo-rg"}},"_links":{"self":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493"},"html":{"href":"https://github.com/raccoongang/edx-platform/pull/493"},"issue":{"href":"https://api.github.com/repos/raccoongang/edx-platform/issues/493"},"comments":{"href":"https://api.github.com/repos/raccoongang/edx-platform/issues/493/comments"},"review_comments":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493/comments"},"review_comment":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/raccoongang/edx-platform/pulls/493/commits"},"statuses":{"href":"https://api.github.com/repos/raccoongang/edx-platform/statuses/68dfc631c06cbe9357ff1a4658f26f982ae94e0f"}},"author_association":"NONE"}}
{"actor":{"display_login":"idegtiarov"}}