payload: {"action":"created","comment":{"url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/comments/307849730","pull_request_review_id":267325708,"id":307849730,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMwNzg0OTczMA==","diff_hunk":"@@ -38,96 +38,124 @@ def drop_db():\n     return True\n \n \n-def offer_get(marketplace_offer_id):\n-    return get_session().query(models.Offer).filter_by(\n-        marketplace_offer_id=marketplace_offer_id).first()\n+def offer_get(marketplace_offer_id, context):\n \n+    if context.is_admin:\n+        return get_session().query(models.Offer).filter_by(\n+            marketplace_offer_id=marketplace_offer_id).first()\n+    else:\n+        return get_session().query(models.Offer).filter_by(\n+            marketplace_offer_id=marketplace_offer_id,\n+            project_id=context.project_id).first()","path":"flocx_market/db/sqlalchemy/api.py","position":15,"original_position":15,"commit_id":"648d9adc7b2795e65793578abfcb71faa16db25d","original_commit_id":"648d9adc7b2795e65793578abfcb71faa16db25d","user":{"login":"tzumainn","id":1280178,"node_id":"MDQ6VXNlcjEyODAxNzg=","avatar_url":"https://avatars3.githubusercontent.com/u/1280178?v=4","gravatar_id":"","url":"https://api.github.com/users/tzumainn","html_url":"https://github.com/tzumainn","followers_url":"https://api.github.com/users/tzumainn/followers","following_url":"https://api.github.com/users/tzumainn/following{/other_user}","gists_url":"https://api.github.com/users/tzumainn/gists{/gist_id}","starred_url":"https://api.github.com/users/tzumainn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzumainn/subscriptions","organizations_url":"https://api.github.com/users/tzumainn/orgs","repos_url":"https://api.github.com/users/tzumainn/repos","events_url":"https://api.github.com/users/tzumainn/events{/privacy}","received_events_url":"https://api.github.com/users/tzumainn/received_events","type":"User","site_admin":false},"body":"For now, I'd suggest creating the get_all_by_project_id function in the database API and the business object layer, but leaving the REST API alone. We can decide later what we want the exact behavior to be.\r\n\r\nI'd consider the API documentation something of a \"living document\" : )","created_at":"2019-07-26T17:57:37Z","updated_at":"2019-07-26T17:57:38Z","html_url":"https://github.com/CCI-MOC/flocx-market/pull/103#discussion_r307849730","pull_request_url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/comments/307849730"},"html":{"href":"https://github.com/CCI-MOC/flocx-market/pull/103#discussion_r307849730"},"pull_request":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103"}},"in_reply_to_id":307749692},"pull_request":{"url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103","id":301250451,"node_id":"MDExOlB1bGxSZXF1ZXN0MzAxMjUwNDUx","html_url":"https://github.com/CCI-MOC/flocx-market/pull/103","diff_url":"https://github.com/CCI-MOC/flocx-market/pull/103.diff","patch_url":"https://github.com/CCI-MOC/flocx-market/pull/103.patch","issue_url":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/103","number":103,"state":"open","locked":false,"title":"Scoping offer objects","user":{"login":"ljmcgann","id":33186994,"node_id":"MDQ6VXNlcjMzMTg2OTk0","avatar_url":"https://avatars3.githubusercontent.com/u/33186994?v=4","gravatar_id":"","url":"https://api.github.com/users/ljmcgann","html_url":"https://github.com/ljmcgann","followers_url":"https://api.github.com/users/ljmcgann/followers","following_url":"https://api.github.com/users/ljmcgann/following{/other_user}","gists_url":"https://api.github.com/users/ljmcgann/gists{/gist_id}","starred_url":"https://api.github.com/users/ljmcgann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljmcgann/subscriptions","organizations_url":"https://api.github.com/users/ljmcgann/orgs","repos_url":"https://api.github.com/users/ljmcgann/repos","events_url":"https://api.github.com/users/ljmcgann/events{/privacy}","received_events_url":"https://api.github.com/users/ljmcgann/received_events","type":"User","site_admin":false},"body":"Implements checks to database api to scope calls to ensure proper access\r\nto objects. Uses oslo_context to pass a project_id to object creation,\r\nand when querying database, checks that oslo_context project_id matches\r\nwith the object's project_id or that the context belongs to an admin.\r\nTG-163","created_at":"2019-07-25T17:59:35Z","updated_at":"2019-07-26T17:57:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6be7c34a8b67b582c9055dbb0b40edc9283df1f6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103/commits","review_comments_url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103/comments","review_comment_url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/103/comments","statuses_url":"https://api.github.com/repos/CCI-MOC/flocx-market/statuses/648d9adc7b2795e65793578abfcb71faa16db25d","head":{"label":"ljmcgann:scope-database","ref":"scope-database","sha":"648d9adc7b2795e65793578abfcb71faa16db25d","user":{"login":"ljmcgann","id":33186994,"node_id":"MDQ6VXNlcjMzMTg2OTk0","avatar_url":"https://avatars3.githubusercontent.com/u/33186994?v=4","gravatar_id":"","url":"https://api.github.com/users/ljmcgann","html_url":"https://github.com/ljmcgann","followers_url":"https://api.github.com/users/ljmcgann/followers","following_url":"https://api.github.com/users/ljmcgann/following{/other_user}","gists_url":"https://api.github.com/users/ljmcgann/gists{/gist_id}","starred_url":"https://api.github.com/users/ljmcgann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljmcgann/subscriptions","organizations_url":"https://api.github.com/users/ljmcgann/orgs","repos_url":"https://api.github.com/users/ljmcgann/repos","events_url":"https://api.github.com/users/ljmcgann/events{/privacy}","received_events_url":"https://api.github.com/users/ljmcgann/received_events","type":"User","site_admin":false},"repo":{"id":193584196,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM1ODQxOTY=","name":"flocx-market","full_name":"ljmcgann/flocx-market","private":false,"owner":{"login":"ljmcgann","id":33186994,"node_id":"MDQ6VXNlcjMzMTg2OTk0","avatar_url":"https://avatars3.githubusercontent.com/u/33186994?v=4","gravatar_id":"","url":"https://api.github.com/users/ljmcgann","html_url":"https://github.com/ljmcgann","followers_url":"https://api.github.com/users/ljmcgann/followers","following_url":"https://api.github.com/users/ljmcgann/following{/other_user}","gists_url":"https://api.github.com/users/ljmcgann/gists{/gist_id}","starred_url":"https://api.github.com/users/ljmcgann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljmcgann/subscriptions","organizations_url":"https://api.github.com/users/ljmcgann/orgs","repos_url":"https://api.github.com/users/ljmcgann/repos","events_url":"https://api.github.com/users/ljmcgann/events{/privacy}","received_events_url":"https://api.github.com/users/ljmcgann/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ljmcgann/flocx-market","description":null,"fork":true,"url":"https://api.github.com/repos/ljmcgann/flocx-market","forks_url":"https://api.github.com/repos/ljmcgann/flocx-market/forks","keys_url":"https://api.github.com/repos/ljmcgann/flocx-market/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ljmcgann/flocx-market/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ljmcgann/flocx-market/teams","hooks_url":"https://api.github.com/repos/ljmcgann/flocx-market/hooks","issue_events_url":"https://api.github.com/repos/ljmcgann/flocx-market/issues/events{/number}","events_url":"https://api.github.com/repos/ljmcgann/flocx-market/events","assignees_url":"https://api.github.com/repos/ljmcgann/flocx-market/assignees{/user}","branches_url":"https://api.github.com/repos/ljmcgann/flocx-market/branches{/branch}","tags_url":"https://api.github.com/repos/ljmcgann/flocx-market/tags","blobs_url":"https://api.github.com/repos/ljmcgann/flocx-market/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ljmcgann/flocx-market/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ljmcgann/flocx-market/git/refs{/sha}","trees_url":"https://api.github.com/repos/ljmcgann/flocx-market/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ljmcgann/flocx-market/statuses/{sha}","languages_url":"https://api.github.com/repos/ljmcgann/flocx-market/languages","stargazers_url":"https://api.github.com/repos/ljmcgann/flocx-market/stargazers","contributors_url":"https://api.github.com/repos/ljmcgann/flocx-market/contributors","subscribers_url":"https://api.github.com/repos/ljmcgann/flocx-market/subscribers","subscription_url":"https://api.github.com/repos/ljmcgann/flocx-market/subscription","commits_url":"https://api.github.com/repos/ljmcgann/flocx-market/commits{/sha}","git_commits_url":"https://api.github.com/repos/ljmcgann/flocx-market/git/commits{/sha}","comments_url":"https://api.github.com/repos/ljmcgann/flocx-market/comments{/number}","issue_comment_url":"https://api.github.com/repos/ljmcgann/flocx-market/issues/comments{/number}","contents_url":"https://api.github.com/repos/ljmcgann/flocx-market/contents/{+path}","compare_url":"https://api.github.com/repos/ljmcgann/flocx-market/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ljmcgann/flocx-market/merges","archive_url":"https://api.github.com/repos/ljmcgann/flocx-market/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ljmcgann/flocx-market/downloads","issues_url":"https://api.github.com/repos/ljmcgann/flocx-market/issues{/number}","pulls_url":"https://api.github.com/repos/ljmcgann/flocx-market/pulls{/number}","milestones_url":"https://api.github.com/repos/ljmcgann/flocx-market/milestones{/number}","notifications_url":"https://api.github.com/repos/ljmcgann/flocx-market/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ljmcgann/flocx-market/labels{/name}","releases_url":"https://api.github.com/repos/ljmcgann/flocx-market/releases{/id}","deployments_url":"https://api.github.com/repos/ljmcgann/flocx-market/deployments","created_at":"2019-06-24T21:38:06Z","updated_at":"2019-07-25T17:52:18Z","pushed_at":"2019-07-25T21:05:41Z","git_url":"git://github.com/ljmcgann/flocx-market.git","ssh_url":"git@github.com:ljmcgann/flocx-market.git","clone_url":"https://github.com/ljmcgann/flocx-market.git","svn_url":"https://github.com/ljmcgann/flocx-market","homepage":"","size":156,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CCI-MOC:master","ref":"master","sha":"8882de5f82ccbad4baa984d9c499a1d886651f72","user":{"login":"CCI-MOC","id":3578683,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzg2ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/3578683?v=4","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"repo":{"id":188483643,"node_id":"MDEwOlJlcG9zaXRvcnkxODg0ODM2NDM=","name":"flocx-market","full_name":"CCI-MOC/flocx-market","private":false,"owner":{"login":"CCI-MOC","id":3578683,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzg2ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/3578683?v=4","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CCI-MOC/flocx-market","description":null,"fork":false,"url":"https://api.github.com/repos/CCI-MOC/flocx-market","forks_url":"https://api.github.com/repos/CCI-MOC/flocx-market/forks","keys_url":"https://api.github.com/repos/CCI-MOC/flocx-market/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CCI-MOC/flocx-market/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CCI-MOC/flocx-market/teams","hooks_url":"https://api.github.com/repos/CCI-MOC/flocx-market/hooks","issue_events_url":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/events{/number}","events_url":"https://api.github.com/repos/CCI-MOC/flocx-market/events","assignees_url":"https://api.github.com/repos/CCI-MOC/flocx-market/assignees{/user}","branches_url":"https://api.github.com/repos/CCI-MOC/flocx-market/branches{/branch}","tags_url":"https://api.github.com/repos/CCI-MOC/flocx-market/tags","blobs_url":"https://api.github.com/repos/CCI-MOC/flocx-market/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CCI-MOC/flocx-market/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CCI-MOC/flocx-market/git/refs{/sha}","trees_url":"https://api.github.com/repos/CCI-MOC/flocx-market/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CCI-MOC/flocx-market/statuses/{sha}","languages_url":"https://api.github.com/repos/CCI-MOC/flocx-market/languages","stargazers_url":"https://api.github.com/repos/CCI-MOC/flocx-market/stargazers","contributors_url":"https://api.github.com/repos/CCI-MOC/flocx-market/contributors","subscribers_url":"https://api.github.com/repos/CCI-MOC/flocx-market/subscribers","subscription_url":"https://api.github.com/repos/CCI-MOC/flocx-market/subscription","commits_url":"https://api.github.com/repos/CCI-MOC/flocx-market/commits{/sha}","git_commits_url":"https://api.github.com/repos/CCI-MOC/flocx-market/git/commits{/sha}","comments_url":"https://api.github.com/repos/CCI-MOC/flocx-market/comments{/number}","issue_comment_url":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/comments{/number}","contents_url":"https://api.github.com/repos/CCI-MOC/flocx-market/contents/{+path}","compare_url":"https://api.github.com/repos/CCI-MOC/flocx-market/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CCI-MOC/flocx-market/merges","archive_url":"https://api.github.com/repos/CCI-MOC/flocx-market/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CCI-MOC/flocx-market/downloads","issues_url":"https://api.github.com/repos/CCI-MOC/flocx-market/issues{/number}","pulls_url":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls{/number}","milestones_url":"https://api.github.com/repos/CCI-MOC/flocx-market/milestones{/number}","notifications_url":"https://api.github.com/repos/CCI-MOC/flocx-market/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CCI-MOC/flocx-market/labels{/name}","releases_url":"https://api.github.com/repos/CCI-MOC/flocx-market/releases{/id}","deployments_url":"https://api.github.com/repos/CCI-MOC/flocx-market/deployments","created_at":"2019-05-24T20:28:40Z","updated_at":"2019-07-26T15:39:34Z","pushed_at":"2019-07-26T17:43:53Z","git_url":"git://github.com/CCI-MOC/flocx-market.git","ssh_url":"git@github.com:CCI-MOC/flocx-market.git","clone_url":"https://github.com/CCI-MOC/flocx-market.git","svn_url":"https://github.com/CCI-MOC/flocx-market","homepage":"","size":147,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":7,"license":null,"forks":8,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103"},"html":{"href":"https://github.com/CCI-MOC/flocx-market/pull/103"},"issue":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/103"},"comments":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/CCI-MOC/flocx-market/statuses/648d9adc7b2795e65793578abfcb71faa16db25d"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"tzumainn"}}