{"action":"created","comment":{"url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/comments/25854995","id":25854995,"diff_hunk":"@@ -0,0 +1,107 @@\n+from pyramid.exceptions import NotFound, Forbidden\n+\n+from cornice import Service\n+from cornice.resource import resource, view\n+\n+from unicore.hub.service.models import App\n+from unicore.hub.service.schema import App as AppSchema\n+from unicore.hub.service import utils\n+\n+\n+def require_principal(request, principals):\n+    effective_principals = set(request.effective_principals)\n+    accepted_principals = set(principals)\n+    if not effective_principals.intersection(accepted_principals):\n+        raise Forbidden\n+\n+\n+def get_app_object(request):\n+    app_id = request.matchdict['app_id']\n+    app = request.db.query(App).get(app_id)\n+\n+    if app is None:\n+        raise NotFound\n+\n+    return app\n+\n+\n+@resource(collection_path='/apps', path='/apps/{app_id:\\d+}')","path":"unicore/hub/service/app_api.py","position":28,"original_position":28,"commit_id":"0841d2113fac3261900280a1ff4149529484a1fd","original_commit_id":"0841d2113fac3261900280a1ff4149529484a1fd","user":{"login":"miltontony","id":623417,"avatar_url":"https://avatars.githubusercontent.com/u/623417?v=3","gravatar_id":"","url":"https://api.github.com/users/miltontony","html_url":"https://github.com/miltontony","followers_url":"https://api.github.com/users/miltontony/followers","following_url":"https://api.github.com/users/miltontony/following{/other_user}","gists_url":"https://api.github.com/users/miltontony/gists{/gist_id}","starred_url":"https://api.github.com/users/miltontony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miltontony/subscriptions","organizations_url":"https://api.github.com/users/miltontony/orgs","repos_url":"https://api.github.com/users/miltontony/repos","events_url":"https://api.github.com/users/miltontony/events{/privacy}","received_events_url":"https://api.github.com/users/miltontony/received_events","type":"User","site_admin":false},"body":"shouldn't the app identifier be a slug instead of the ID?","created_at":"2015-03-05T10:54:23Z","updated_at":"2015-03-05T10:54:23Z","html_url":"https://github.com/universalcore/unicore.hub/pull/4#discussion_r25854995","pull_request_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/comments/25854995"},"html":{"href":"https://github.com/universalcore/unicore.hub/pull/4#discussion_r25854995"},"pull_request":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4","id":30545112,"html_url":"https://github.com/universalcore/unicore.hub/pull/4","diff_url":"https://github.com/universalcore/unicore.hub/pull/4.diff","patch_url":"https://github.com/universalcore/unicore.hub/pull/4.patch","issue_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/4","number":4,"state":"open","locked":false,"title":"create apps and autogenerate password","user":{"login":"Rizziepit","id":588701,"avatar_url":"https://avatars.githubusercontent.com/u/588701?v=3","gravatar_id":"","url":"https://api.github.com/users/Rizziepit","html_url":"https://github.com/Rizziepit","followers_url":"https://api.github.com/users/Rizziepit/followers","following_url":"https://api.github.com/users/Rizziepit/following{/other_user}","gists_url":"https://api.github.com/users/Rizziepit/gists{/gist_id}","starred_url":"https://api.github.com/users/Rizziepit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rizziepit/subscriptions","organizations_url":"https://api.github.com/users/Rizziepit/orgs","repos_url":"https://api.github.com/users/Rizziepit/repos","events_url":"https://api.github.com/users/Rizziepit/events{/privacy}","received_events_url":"https://api.github.com/users/Rizziepit/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-05T10:23:10Z","updated_at":"2015-03-05T10:54:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b016b4876d5f1fb5a56216daa533dfc6b1527370","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4/commits","review_comments_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4/comments","review_comment_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/4/comments","statuses_url":"https://api.github.com/repos/universalcore/unicore.hub/statuses/0841d2113fac3261900280a1ff4149529484a1fd","head":{"label":"universalcore:feature/issue-4-autogenerate-app-password","ref":"feature/issue-4-autogenerate-app-password","sha":"0841d2113fac3261900280a1ff4149529484a1fd","user":{"login":"universalcore","id":8818658,"avatar_url":"https://avatars.githubusercontent.com/u/8818658?v=3","gravatar_id":"","url":"https://api.github.com/users/universalcore","html_url":"https://github.com/universalcore","followers_url":"https://api.github.com/users/universalcore/followers","following_url":"https://api.github.com/users/universalcore/following{/other_user}","gists_url":"https://api.github.com/users/universalcore/gists{/gist_id}","starred_url":"https://api.github.com/users/universalcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universalcore/subscriptions","organizations_url":"https://api.github.com/users/universalcore/orgs","repos_url":"https://api.github.com/users/universalcore/repos","events_url":"https://api.github.com/users/universalcore/events{/privacy}","received_events_url":"https://api.github.com/users/universalcore/received_events","type":"Organization","site_admin":false},"repo":{"id":31374421,"name":"unicore.hub","full_name":"universalcore/unicore.hub","owner":{"login":"universalcore","id":8818658,"avatar_url":"https://avatars.githubusercontent.com/u/8818658?v=3","gravatar_id":"","url":"https://api.github.com/users/universalcore","html_url":"https://github.com/universalcore","followers_url":"https://api.github.com/users/universalcore/followers","following_url":"https://api.github.com/users/universalcore/following{/other_user}","gists_url":"https://api.github.com/users/universalcore/gists{/gist_id}","starred_url":"https://api.github.com/users/universalcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universalcore/subscriptions","organizations_url":"https://api.github.com/users/universalcore/orgs","repos_url":"https://api.github.com/users/universalcore/repos","events_url":"https://api.github.com/users/universalcore/events{/privacy}","received_events_url":"https://api.github.com/users/universalcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/universalcore/unicore.hub","description":"User authentication and data storage for universal core.","fork":false,"url":"https://api.github.com/repos/universalcore/unicore.hub","forks_url":"https://api.github.com/repos/universalcore/unicore.hub/forks","keys_url":"https://api.github.com/repos/universalcore/unicore.hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/universalcore/unicore.hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/universalcore/unicore.hub/teams","hooks_url":"https://api.github.com/repos/universalcore/unicore.hub/hooks","issue_events_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/events{/number}","events_url":"https://api.github.com/repos/universalcore/unicore.hub/events","assignees_url":"https://api.github.com/repos/universalcore/unicore.hub/assignees{/user}","branches_url":"https://api.github.com/repos/universalcore/unicore.hub/branches{/branch}","tags_url":"https://api.github.com/repos/universalcore/unicore.hub/tags","blobs_url":"https://api.github.com/repos/universalcore/unicore.hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/universalcore/unicore.hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/universalcore/unicore.hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/universalcore/unicore.hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/universalcore/unicore.hub/statuses/{sha}","languages_url":"https://api.github.com/repos/universalcore/unicore.hub/languages","stargazers_url":"https://api.github.com/repos/universalcore/unicore.hub/stargazers","contributors_url":"https://api.github.com/repos/universalcore/unicore.hub/contributors","subscribers_url":"https://api.github.com/repos/universalcore/unicore.hub/subscribers","subscription_url":"https://api.github.com/repos/universalcore/unicore.hub/subscription","commits_url":"https://api.github.com/repos/universalcore/unicore.hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/universalcore/unicore.hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/universalcore/unicore.hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/universalcore/unicore.hub/contents/{+path}","compare_url":"https://api.github.com/repos/universalcore/unicore.hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/universalcore/unicore.hub/merges","archive_url":"https://api.github.com/repos/universalcore/unicore.hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/universalcore/unicore.hub/downloads","issues_url":"https://api.github.com/repos/universalcore/unicore.hub/issues{/number}","pulls_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls{/number}","milestones_url":"https://api.github.com/repos/universalcore/unicore.hub/milestones{/number}","notifications_url":"https://api.github.com/repos/universalcore/unicore.hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/universalcore/unicore.hub/labels{/name}","releases_url":"https://api.github.com/repos/universalcore/unicore.hub/releases{/id}","created_at":"2015-02-26T15:45:44Z","updated_at":"2015-03-04T07:16:34Z","pushed_at":"2015-03-05T10:23:01Z","git_url":"git://github.com/universalcore/unicore.hub.git","ssh_url":"git@github.com:universalcore/unicore.hub.git","clone_url":"https://github.com/universalcore/unicore.hub.git","svn_url":"https://github.com/universalcore/unicore.hub","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"develop"}},"base":{"label":"universalcore:develop","ref":"develop","sha":"87ab35ff402453c14bd956a6995bd04fe351e3d8","user":{"login":"universalcore","id":8818658,"avatar_url":"https://avatars.githubusercontent.com/u/8818658?v=3","gravatar_id":"","url":"https://api.github.com/users/universalcore","html_url":"https://github.com/universalcore","followers_url":"https://api.github.com/users/universalcore/followers","following_url":"https://api.github.com/users/universalcore/following{/other_user}","gists_url":"https://api.github.com/users/universalcore/gists{/gist_id}","starred_url":"https://api.github.com/users/universalcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universalcore/subscriptions","organizations_url":"https://api.github.com/users/universalcore/orgs","repos_url":"https://api.github.com/users/universalcore/repos","events_url":"https://api.github.com/users/universalcore/events{/privacy}","received_events_url":"https://api.github.com/users/universalcore/received_events","type":"Organization","site_admin":false},"repo":{"id":31374421,"name":"unicore.hub","full_name":"universalcore/unicore.hub","owner":{"login":"universalcore","id":8818658,"avatar_url":"https://avatars.githubusercontent.com/u/8818658?v=3","gravatar_id":"","url":"https://api.github.com/users/universalcore","html_url":"https://github.com/universalcore","followers_url":"https://api.github.com/users/universalcore/followers","following_url":"https://api.github.com/users/universalcore/following{/other_user}","gists_url":"https://api.github.com/users/universalcore/gists{/gist_id}","starred_url":"https://api.github.com/users/universalcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universalcore/subscriptions","organizations_url":"https://api.github.com/users/universalcore/orgs","repos_url":"https://api.github.com/users/universalcore/repos","events_url":"https://api.github.com/users/universalcore/events{/privacy}","received_events_url":"https://api.github.com/users/universalcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/universalcore/unicore.hub","description":"User authentication and data storage for universal core.","fork":false,"url":"https://api.github.com/repos/universalcore/unicore.hub","forks_url":"https://api.github.com/repos/universalcore/unicore.hub/forks","keys_url":"https://api.github.com/repos/universalcore/unicore.hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/universalcore/unicore.hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/universalcore/unicore.hub/teams","hooks_url":"https://api.github.com/repos/universalcore/unicore.hub/hooks","issue_events_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/events{/number}","events_url":"https://api.github.com/repos/universalcore/unicore.hub/events","assignees_url":"https://api.github.com/repos/universalcore/unicore.hub/assignees{/user}","branches_url":"https://api.github.com/repos/universalcore/unicore.hub/branches{/branch}","tags_url":"https://api.github.com/repos/universalcore/unicore.hub/tags","blobs_url":"https://api.github.com/repos/universalcore/unicore.hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/universalcore/unicore.hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/universalcore/unicore.hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/universalcore/unicore.hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/universalcore/unicore.hub/statuses/{sha}","languages_url":"https://api.github.com/repos/universalcore/unicore.hub/languages","stargazers_url":"https://api.github.com/repos/universalcore/unicore.hub/stargazers","contributors_url":"https://api.github.com/repos/universalcore/unicore.hub/contributors","subscribers_url":"https://api.github.com/repos/universalcore/unicore.hub/subscribers","subscription_url":"https://api.github.com/repos/universalcore/unicore.hub/subscription","commits_url":"https://api.github.com/repos/universalcore/unicore.hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/universalcore/unicore.hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/universalcore/unicore.hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/universalcore/unicore.hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/universalcore/unicore.hub/contents/{+path}","compare_url":"https://api.github.com/repos/universalcore/unicore.hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/universalcore/unicore.hub/merges","archive_url":"https://api.github.com/repos/universalcore/unicore.hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/universalcore/unicore.hub/downloads","issues_url":"https://api.github.com/repos/universalcore/unicore.hub/issues{/number}","pulls_url":"https://api.github.com/repos/universalcore/unicore.hub/pulls{/number}","milestones_url":"https://api.github.com/repos/universalcore/unicore.hub/milestones{/number}","notifications_url":"https://api.github.com/repos/universalcore/unicore.hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/universalcore/unicore.hub/labels{/name}","releases_url":"https://api.github.com/repos/universalcore/unicore.hub/releases{/id}","created_at":"2015-02-26T15:45:44Z","updated_at":"2015-03-04T07:16:34Z","pushed_at":"2015-03-05T10:23:01Z","git_url":"git://github.com/universalcore/unicore.hub.git","ssh_url":"git@github.com:universalcore/unicore.hub.git","clone_url":"https://github.com/universalcore/unicore.hub.git","svn_url":"https://github.com/universalcore/unicore.hub","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4"},"html":{"href":"https://github.com/universalcore/unicore.hub/pull/4"},"issue":{"href":"https://api.github.com/repos/universalcore/unicore.hub/issues/4"},"comments":{"href":"https://api.github.com/repos/universalcore/unicore.hub/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/universalcore/unicore.hub/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/universalcore/unicore.hub/statuses/0841d2113fac3261900280a1ff4149529484a1fd"}}}}