{"action":"created","comment":{"url":"https://api.github.com/repos/biocore/qiita/pulls/comments/52781956","id":52781956,"diff_hunk":"@@ -53,3 +57,126 @@ def artifact_graph_get_req(artifact_id, direction, user_id):\n             'node_labels': node_labels,\n             'status': 'success',\n             'message': ''}\n+\n+\n+def artifact_get_req(artifact_id, user_id):\n+    \"\"\"Get information about the artifact\n+\n+    Parameters\n+    ----------\n+    artifact_id : int\n+        Artifact being acted on\n+    user_id : str\n+        The user requesting the action\n+\n+    Returns\n+    -------\n+    dict\n+        information about the artifact\n+    \"\"\"\n+    pd = Artifact(int(artifact_id))\n+    access_error = check_access(pd.study.id, user_id)\n+    if access_error:\n+        return access_error\n+\n+    can_submit_to_ebi = pd.can_be_submitted_to_ebi\n+    ebi_run_accessions = pd.ebi_run_accessions if can_submit_to_ebi else None\n+\n+    can_submit_to_vamps = pd.can_be_submitted_to_vamps\n+    is_submitted_to_vamps = pd.is_submitted_to_vamps if can_submit_to_vamps \\\n+        else False\n+\n+    return {\n+        'timestamp': pd.timestamp,\n+        'processing_parameters': pd.processing_parameters,\n+        'visibility': pd.visibility,\n+        'artifact_type': pd.artifact_type,\n+        'data_type': pd.data_type,\n+        'can_be_submitted_to_ebi': can_submit_to_ebi,\n+        'can_be_submitted_to_vamps': can_submit_to_vamps,\n+        'is_submitted_to_vamps': is_submitted_to_vamps,\n+        'filepaths': pd.filepaths,\n+        'parents': [a.id for a in pd.parents],\n+        'prep_templates': [p.id for p in pd.prep_templates],\n+        'ebi_run_accessions': ebi_run_accessions,\n+        'study': pd.study.id}\n+\n+\n+def artifact_delete_req(artifact_id, user_id):\n+    \"\"\"Deletes the artifact\n+\n+    Parameters\n+    ----------\n+    artifact_id : int\n+        Artifact being acted on\n+    user_id : str\n+        The user requesting the action\n+\n+    Returns\n+    -------\n+    dict\n+        Status of action, in the form {'status': status, 'message': msg}\n+        status: status of the action, either success or error\n+        message: Human readable message for status\n+    \"\"\"\n+    pd = Artifact(int(artifact_id))\n+    access_error = check_access(pd.study.id, user_id)\n+    if access_error:\n+        return access_error\n+    try:\n+        Artifact.delete(int(artifact_id))\n+    except QiitaDBArtifactDeletionError as e:\n+        return {'status': 'error',\n+                'message': str(e)}\n+    return {'status': 'success',\n+            'message': ''}\n+\n+\n+def artifact_status_put_req(artifact_id, user_id, visibility):\n+    \"\"\"Set the status of the artifact given\n+\n+    Parameters\n+    ----------\n+    artifact_id : int\n+        Artifact being acted on\n+    user_id : str\n+        The user requesting the action\n+    visibility : {'sandbox', 'awaiting_approval', 'private', 'public'}\n+        What to change the visibility to\n+\n+    Returns\n+    -------\n+    dict\n+        Status of action, in the form {'status': status, 'message': msg}\n+        status: status of the action, either success or error\n+        message: Human readable message for status\n+    \"\"\"\n+    if visibility not in get_visibilities():\n+        return {'status': 'error',\n+                'message': 'Unknown visiblity value: %s' % visibility}\n+\n+    pd = Artifact(int(artifact_id))\n+    access_error = check_access(pd.study.id, user_id)\n+    if access_error:\n+        return access_error\n+    user = User(str(user_id))\n+    # Set the approval to private if needs approval and admin\n+    if visibility == 'private':\n+        status = 'success'\n+        msg = 'Artifact visibility changed to private'\n+        if not qiita_config.require_approval:\n+            pd.visibility = 'private'\n+        # Set the approval to private if approval not required\n+        elif user.level == 'admin':\n+            pd.visibility = 'private'\n+        # Trying to set approval without admin privileges\n+        else:\n+            status = 'error'\n+            msg = 'User does not have permissions to approve change'\n+    else:\n+        pd.visibility = visibility\n+        status = 'success'","path":"qiita_pet/handlers/api_proxy/artifact.py","position":133,"original_position":133,"commit_id":"bca59b5132a2112f46a69c26d925ba84f58c0124","original_commit_id":"bca59b5132a2112f46a69c26d925ba84f58c0124","user":{"login":"josenavas","id":2501478,"avatar_url":"https://avatars.githubusercontent.com/u/2501478?v=3","gravatar_id":"","url":"https://api.github.com/users/josenavas","html_url":"https://github.com/josenavas","followers_url":"https://api.github.com/users/josenavas/followers","following_url":"https://api.github.com/users/josenavas/following{/other_user}","gists_url":"https://api.github.com/users/josenavas/gists{/gist_id}","starred_url":"https://api.github.com/users/josenavas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josenavas/subscriptions","organizations_url":"https://api.github.com/users/josenavas/orgs","repos_url":"https://api.github.com/users/josenavas/repos","events_url":"https://api.github.com/users/josenavas/events{/privacy}","received_events_url":"https://api.github.com/users/josenavas/received_events","type":"User","site_admin":false},"body":"@squirrelo ETA on this? Having your PR in will reduce my developing time b/c I will be able to connect the interface and my work in the same PR.","created_at":"2016-02-12T18:54:16Z","updated_at":"2016-02-12T18:54:16Z","html_url":"https://github.com/biocore/qiita/pull/1593#discussion_r52781956","pull_request_url":"https://api.github.com/repos/biocore/qiita/pulls/1593","_links":{"self":{"href":"https://api.github.com/repos/biocore/qiita/pulls/comments/52781956"},"html":{"href":"https://github.com/biocore/qiita/pull/1593#discussion_r52781956"},"pull_request":{"href":"https://api.github.com/repos/biocore/qiita/pulls/1593"}}},"pull_request":{"url":"https://api.github.com/repos/biocore/qiita/pulls/1593","id":54770122,"html_url":"https://github.com/biocore/qiita/pull/1593","diff_url":"https://github.com/biocore/qiita/pull/1593.diff","patch_url":"https://github.com/biocore/qiita/pull/1593.patch","issue_url":"https://api.github.com/repos/biocore/qiita/issues/1593","number":1593,"state":"open","locked":false,"title":"Admin actions","user":{"login":"squirrelo","id":3079066,"avatar_url":"https://avatars.githubusercontent.com/u/3079066?v=3","gravatar_id":"","url":"https://api.github.com/users/squirrelo","html_url":"https://github.com/squirrelo","followers_url":"https://api.github.com/users/squirrelo/followers","following_url":"https://api.github.com/users/squirrelo/following{/other_user}","gists_url":"https://api.github.com/users/squirrelo/gists{/gist_id}","starred_url":"https://api.github.com/users/squirrelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squirrelo/subscriptions","organizations_url":"https://api.github.com/users/squirrelo/orgs","repos_url":"https://api.github.com/users/squirrelo/repos","events_url":"https://api.github.com/users/squirrelo/events{/privacy}","received_events_url":"https://api.github.com/users/squirrelo/received_events","type":"User","site_admin":false},"body":"Requires #1590 \r\n\r\nAdds the admin approvals buttons to the interface. Can now change the visibility of all the artifacts individually. Also adds the submit to EBI and VAMPS buttons when applicable.","created_at":"2015-12-30T00:45:06Z","updated_at":"2016-02-12T18:54:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6cbdd4c833184843fd4b8532136e87819b40b1f1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/biocore/qiita/pulls/1593/commits","review_comments_url":"https://api.github.com/repos/biocore/qiita/pulls/1593/comments","review_comment_url":"https://api.github.com/repos/biocore/qiita/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biocore/qiita/issues/1593/comments","statuses_url":"https://api.github.com/repos/biocore/qiita/statuses/bca59b5132a2112f46a69c26d925ba84f58c0124","head":{"label":"squirrelo:admin-actions","ref":"admin-actions","sha":"bca59b5132a2112f46a69c26d925ba84f58c0124","user":{"login":"squirrelo","id":3079066,"avatar_url":"https://avatars.githubusercontent.com/u/3079066?v=3","gravatar_id":"","url":"https://api.github.com/users/squirrelo","html_url":"https://github.com/squirrelo","followers_url":"https://api.github.com/users/squirrelo/followers","following_url":"https://api.github.com/users/squirrelo/following{/other_user}","gists_url":"https://api.github.com/users/squirrelo/gists{/gist_id}","starred_url":"https://api.github.com/users/squirrelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squirrelo/subscriptions","organizations_url":"https://api.github.com/users/squirrelo/orgs","repos_url":"https://api.github.com/users/squirrelo/repos","events_url":"https://api.github.com/users/squirrelo/events{/privacy}","received_events_url":"https://api.github.com/users/squirrelo/received_events","type":"User","site_admin":false},"repo":{"id":21153084,"name":"qiita","full_name":"squirrelo/qiita","owner":{"login":"squirrelo","id":3079066,"avatar_url":"https://avatars.githubusercontent.com/u/3079066?v=3","gravatar_id":"","url":"https://api.github.com/users/squirrelo","html_url":"https://github.com/squirrelo","followers_url":"https://api.github.com/users/squirrelo/followers","following_url":"https://api.github.com/users/squirrelo/following{/other_user}","gists_url":"https://api.github.com/users/squirrelo/gists{/gist_id}","starred_url":"https://api.github.com/users/squirrelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squirrelo/subscriptions","organizations_url":"https://api.github.com/users/squirrelo/orgs","repos_url":"https://api.github.com/users/squirrelo/repos","events_url":"https://api.github.com/users/squirrelo/events{/privacy}","received_events_url":"https://api.github.com/users/squirrelo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/squirrelo/qiita","description":"Qiita - A QIIME databasing effort","fork":true,"url":"https://api.github.com/repos/squirrelo/qiita","forks_url":"https://api.github.com/repos/squirrelo/qiita/forks","keys_url":"https://api.github.com/repos/squirrelo/qiita/keys{/key_id}","collaborators_url":"https://api.github.com/repos/squirrelo/qiita/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/squirrelo/qiita/teams","hooks_url":"https://api.github.com/repos/squirrelo/qiita/hooks","issue_events_url":"https://api.github.com/repos/squirrelo/qiita/issues/events{/number}","events_url":"https://api.github.com/repos/squirrelo/qiita/events","assignees_url":"https://api.github.com/repos/squirrelo/qiita/assignees{/user}","branches_url":"https://api.github.com/repos/squirrelo/qiita/branches{/branch}","tags_url":"https://api.github.com/repos/squirrelo/qiita/tags","blobs_url":"https://api.github.com/repos/squirrelo/qiita/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/squirrelo/qiita/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/squirrelo/qiita/git/refs{/sha}","trees_url":"https://api.github.com/repos/squirrelo/qiita/git/trees{/sha}","statuses_url":"https://api.github.com/repos/squirrelo/qiita/statuses/{sha}","languages_url":"https://api.github.com/repos/squirrelo/qiita/languages","stargazers_url":"https://api.github.com/repos/squirrelo/qiita/stargazers","contributors_url":"https://api.github.com/repos/squirrelo/qiita/contributors","subscribers_url":"https://api.github.com/repos/squirrelo/qiita/subscribers","subscription_url":"https://api.github.com/repos/squirrelo/qiita/subscription","commits_url":"https://api.github.com/repos/squirrelo/qiita/commits{/sha}","git_commits_url":"https://api.github.com/repos/squirrelo/qiita/git/commits{/sha}","comments_url":"https://api.github.com/repos/squirrelo/qiita/comments{/number}","issue_comment_url":"https://api.github.com/repos/squirrelo/qiita/issues/comments{/number}","contents_url":"https://api.github.com/repos/squirrelo/qiita/contents/{+path}","compare_url":"https://api.github.com/repos/squirrelo/qiita/compare/{base}...{head}","merges_url":"https://api.github.com/repos/squirrelo/qiita/merges","archive_url":"https://api.github.com/repos/squirrelo/qiita/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/squirrelo/qiita/downloads","issues_url":"https://api.github.com/repos/squirrelo/qiita/issues{/number}","pulls_url":"https://api.github.com/repos/squirrelo/qiita/pulls{/number}","milestones_url":"https://api.github.com/repos/squirrelo/qiita/milestones{/number}","notifications_url":"https://api.github.com/repos/squirrelo/qiita/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/squirrelo/qiita/labels{/name}","releases_url":"https://api.github.com/repos/squirrelo/qiita/releases{/id}","deployments_url":"https://api.github.com/repos/squirrelo/qiita/deployments","created_at":"2014-06-24T05:18:58Z","updated_at":"2016-01-25T16:29:06Z","pushed_at":"2016-02-11T04:47:28Z","git_url":"git://github.com/squirrelo/qiita.git","ssh_url":"git@github.com:squirrelo/qiita.git","clone_url":"https://github.com/squirrelo/qiita.git","svn_url":"https://github.com/squirrelo/qiita","homepage":"","size":22769,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"biocore:artifact-study-pages","ref":"artifact-study-pages","sha":"c62daae8e0d3b07f0f3fcc88a7ab63e1b8b13617","user":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"repo":{"id":13131245,"name":"qiita","full_name":"biocore/qiita","owner":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biocore/qiita","description":"Qiita - A QIIME databasing effort","fork":false,"url":"https://api.github.com/repos/biocore/qiita","forks_url":"https://api.github.com/repos/biocore/qiita/forks","keys_url":"https://api.github.com/repos/biocore/qiita/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biocore/qiita/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biocore/qiita/teams","hooks_url":"https://api.github.com/repos/biocore/qiita/hooks","issue_events_url":"https://api.github.com/repos/biocore/qiita/issues/events{/number}","events_url":"https://api.github.com/repos/biocore/qiita/events","assignees_url":"https://api.github.com/repos/biocore/qiita/assignees{/user}","branches_url":"https://api.github.com/repos/biocore/qiita/branches{/branch}","tags_url":"https://api.github.com/repos/biocore/qiita/tags","blobs_url":"https://api.github.com/repos/biocore/qiita/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biocore/qiita/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biocore/qiita/git/refs{/sha}","trees_url":"https://api.github.com/repos/biocore/qiita/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biocore/qiita/statuses/{sha}","languages_url":"https://api.github.com/repos/biocore/qiita/languages","stargazers_url":"https://api.github.com/repos/biocore/qiita/stargazers","contributors_url":"https://api.github.com/repos/biocore/qiita/contributors","subscribers_url":"https://api.github.com/repos/biocore/qiita/subscribers","subscription_url":"https://api.github.com/repos/biocore/qiita/subscription","commits_url":"https://api.github.com/repos/biocore/qiita/commits{/sha}","git_commits_url":"https://api.github.com/repos/biocore/qiita/git/commits{/sha}","comments_url":"https://api.github.com/repos/biocore/qiita/comments{/number}","issue_comment_url":"https://api.github.com/repos/biocore/qiita/issues/comments{/number}","contents_url":"https://api.github.com/repos/biocore/qiita/contents/{+path}","compare_url":"https://api.github.com/repos/biocore/qiita/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biocore/qiita/merges","archive_url":"https://api.github.com/repos/biocore/qiita/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biocore/qiita/downloads","issues_url":"https://api.github.com/repos/biocore/qiita/issues{/number}","pulls_url":"https://api.github.com/repos/biocore/qiita/pulls{/number}","milestones_url":"https://api.github.com/repos/biocore/qiita/milestones{/number}","notifications_url":"https://api.github.com/repos/biocore/qiita/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biocore/qiita/labels{/name}","releases_url":"https://api.github.com/repos/biocore/qiita/releases{/id}","deployments_url":"https://api.github.com/repos/biocore/qiita/deployments","created_at":"2013-09-26T18:50:43Z","updated_at":"2016-01-31T22:47:34Z","pushed_at":"2016-02-11T19:56:21Z","git_url":"git://github.com/biocore/qiita.git","ssh_url":"git@github.com:biocore/qiita.git","clone_url":"https://github.com/biocore/qiita.git","svn_url":"https://github.com/biocore/qiita","homepage":"http://qiita.microbio.me","size":129676,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":321,"forks":26,"open_issues":321,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biocore/qiita/pulls/1593"},"html":{"href":"https://github.com/biocore/qiita/pull/1593"},"issue":{"href":"https://api.github.com/repos/biocore/qiita/issues/1593"},"comments":{"href":"https://api.github.com/repos/biocore/qiita/issues/1593/comments"},"review_comments":{"href":"https://api.github.com/repos/biocore/qiita/pulls/1593/comments"},"review_comment":{"href":"https://api.github.com/repos/biocore/qiita/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biocore/qiita/pulls/1593/commits"},"statuses":{"href":"https://api.github.com/repos/biocore/qiita/statuses/bca59b5132a2112f46a69c26d925ba84f58c0124"}}}}