{"action":"created","comment":{"url":"https://api.github.com/repos/dropbox/grouper/pulls/comments/53710837","id":53710837,"diff_hunk":"@@ -0,0 +1,23 @@\n+from datetime import datetime\n+\n+from sqlalchemy import or_\n+\n+from grouper.models import Group, GroupEdge\n+\n+\n+def get_groups_by_user(session, user):\n+    \"\"\"Return groups a given user is a member of along with the associated GroupEdge.\n+\n+    Args:\n+        session(): database session\n+        user(models.User): model for user in question\n+    \"\"\"\n+    now = datetime.utcnow()\n+    return session.query(Group, GroupEdge).filter(\n+            GroupEdge.group_id == Group.id,\n+            GroupEdge.member_pk == user.id,\n+            GroupEdge.member_type == 0,\n+            GroupEdge.active == True,\n+            Group.enabled == True,\n+            or_(GroupEdge.expiration > now, GroupEdge.expiration == None),\n+            ).all()","path":"grouper/group.py","position":23,"original_position":23,"commit_id":"a3c151bf88aaa9d8f159b4131a4500eb4978f5a9","original_commit_id":"a3c151bf88aaa9d8f159b4131a4500eb4978f5a9","user":{"login":"lfaraone","id":73410,"avatar_url":"https://avatars.githubusercontent.com/u/73410?v=3","gravatar_id":"","url":"https://api.github.com/users/lfaraone","html_url":"https://github.com/lfaraone","followers_url":"https://api.github.com/users/lfaraone/followers","following_url":"https://api.github.com/users/lfaraone/following{/other_user}","gists_url":"https://api.github.com/users/lfaraone/gists{/gist_id}","starred_url":"https://api.github.com/users/lfaraone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lfaraone/subscriptions","organizations_url":"https://api.github.com/users/lfaraone/orgs","repos_url":"https://api.github.com/users/lfaraone/repos","events_url":"https://api.github.com/users/lfaraone/events{/privacy}","received_events_url":"https://api.github.com/users/lfaraone/received_events","type":"User","site_admin":false},"body":"Pull down the `)` to match the function indent","created_at":"2016-02-22T23:16:13Z","updated_at":"2016-02-22T23:16:13Z","html_url":"https://github.com/dropbox/grouper/pull/156#discussion_r53710837","pull_request_url":"https://api.github.com/repos/dropbox/grouper/pulls/156","_links":{"self":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/comments/53710837"},"html":{"href":"https://github.com/dropbox/grouper/pull/156#discussion_r53710837"},"pull_request":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/156"}}},"pull_request":{"url":"https://api.github.com/repos/dropbox/grouper/pulls/156","id":58501326,"html_url":"https://github.com/dropbox/grouper/pull/156","diff_url":"https://github.com/dropbox/grouper/pull/156.diff","patch_url":"https://github.com/dropbox/grouper/pull/156.patch","issue_url":"https://api.github.com/repos/dropbox/grouper/issues/156","number":156,"state":"open","locked":false,"title":"permission requests (and actions)","user":{"login":"herb","id":139780,"avatar_url":"https://avatars.githubusercontent.com/u/139780?v=3","gravatar_id":"","url":"https://api.github.com/users/herb","html_url":"https://github.com/herb","followers_url":"https://api.github.com/users/herb/followers","following_url":"https://api.github.com/users/herb/following{/other_user}","gists_url":"https://api.github.com/users/herb/gists{/gist_id}","starred_url":"https://api.github.com/users/herb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herb/subscriptions","organizations_url":"https://api.github.com/users/herb/orgs","repos_url":"https://api.github.com/users/herb/repos","events_url":"https://api.github.com/users/herb/events{/privacy}","received_events_url":"https://api.github.com/users/herb/received_events","type":"User","site_admin":false},"body":"this implements everything on the request side. servicing the request is pending as is a real plugin.\r\n\r\nrequesting endpoint:\r\nhttps://www.dropbox.com/s/f4jrbyc6s7gp4wu/Screenshot%202016-02-05%2015.10.52.png?dl=0\r\n\r\nnew group view with 'request permission' button and pending requests shown:\r\nhttps://www.dropbox.com/s/kchrvdp724zrrvc/Screenshot%202016-02-05%2015.11.02.png?dl=0\r\n","created_at":"2016-02-05T23:56:59Z","updated_at":"2016-02-22T23:16:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6596fbc8aabc3c87631abf2dc34433c0dddc319d","assignee":{"login":"rra","id":302330,"avatar_url":"https://avatars.githubusercontent.com/u/302330?v=3","gravatar_id":"","url":"https://api.github.com/users/rra","html_url":"https://github.com/rra","followers_url":"https://api.github.com/users/rra/followers","following_url":"https://api.github.com/users/rra/following{/other_user}","gists_url":"https://api.github.com/users/rra/gists{/gist_id}","starred_url":"https://api.github.com/users/rra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rra/subscriptions","organizations_url":"https://api.github.com/users/rra/orgs","repos_url":"https://api.github.com/users/rra/repos","events_url":"https://api.github.com/users/rra/events{/privacy}","received_events_url":"https://api.github.com/users/rra/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/dropbox/grouper/pulls/156/commits","review_comments_url":"https://api.github.com/repos/dropbox/grouper/pulls/156/comments","review_comment_url":"https://api.github.com/repos/dropbox/grouper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dropbox/grouper/issues/156/comments","statuses_url":"https://api.github.com/repos/dropbox/grouper/statuses/a3c151bf88aaa9d8f159b4131a4500eb4978f5a9","head":{"label":"herb:request_flow","ref":"request_flow","sha":"a3c151bf88aaa9d8f159b4131a4500eb4978f5a9","user":{"login":"herb","id":139780,"avatar_url":"https://avatars.githubusercontent.com/u/139780?v=3","gravatar_id":"","url":"https://api.github.com/users/herb","html_url":"https://github.com/herb","followers_url":"https://api.github.com/users/herb/followers","following_url":"https://api.github.com/users/herb/following{/other_user}","gists_url":"https://api.github.com/users/herb/gists{/gist_id}","starred_url":"https://api.github.com/users/herb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herb/subscriptions","organizations_url":"https://api.github.com/users/herb/orgs","repos_url":"https://api.github.com/users/herb/repos","events_url":"https://api.github.com/users/herb/events{/privacy}","received_events_url":"https://api.github.com/users/herb/received_events","type":"User","site_admin":false},"repo":{"id":40264601,"name":"grouper","full_name":"herb/grouper","owner":{"login":"herb","id":139780,"avatar_url":"https://avatars.githubusercontent.com/u/139780?v=3","gravatar_id":"","url":"https://api.github.com/users/herb","html_url":"https://github.com/herb","followers_url":"https://api.github.com/users/herb/followers","following_url":"https://api.github.com/users/herb/following{/other_user}","gists_url":"https://api.github.com/users/herb/gists{/gist_id}","starred_url":"https://api.github.com/users/herb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herb/subscriptions","organizations_url":"https://api.github.com/users/herb/orgs","repos_url":"https://api.github.com/users/herb/repos","events_url":"https://api.github.com/users/herb/events{/privacy}","received_events_url":"https://api.github.com/users/herb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/herb/grouper","description":"Group Management Server","fork":true,"url":"https://api.github.com/repos/herb/grouper","forks_url":"https://api.github.com/repos/herb/grouper/forks","keys_url":"https://api.github.com/repos/herb/grouper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/herb/grouper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/herb/grouper/teams","hooks_url":"https://api.github.com/repos/herb/grouper/hooks","issue_events_url":"https://api.github.com/repos/herb/grouper/issues/events{/number}","events_url":"https://api.github.com/repos/herb/grouper/events","assignees_url":"https://api.github.com/repos/herb/grouper/assignees{/user}","branches_url":"https://api.github.com/repos/herb/grouper/branches{/branch}","tags_url":"https://api.github.com/repos/herb/grouper/tags","blobs_url":"https://api.github.com/repos/herb/grouper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/herb/grouper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/herb/grouper/git/refs{/sha}","trees_url":"https://api.github.com/repos/herb/grouper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/herb/grouper/statuses/{sha}","languages_url":"https://api.github.com/repos/herb/grouper/languages","stargazers_url":"https://api.github.com/repos/herb/grouper/stargazers","contributors_url":"https://api.github.com/repos/herb/grouper/contributors","subscribers_url":"https://api.github.com/repos/herb/grouper/subscribers","subscription_url":"https://api.github.com/repos/herb/grouper/subscription","commits_url":"https://api.github.com/repos/herb/grouper/commits{/sha}","git_commits_url":"https://api.github.com/repos/herb/grouper/git/commits{/sha}","comments_url":"https://api.github.com/repos/herb/grouper/comments{/number}","issue_comment_url":"https://api.github.com/repos/herb/grouper/issues/comments{/number}","contents_url":"https://api.github.com/repos/herb/grouper/contents/{+path}","compare_url":"https://api.github.com/repos/herb/grouper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/herb/grouper/merges","archive_url":"https://api.github.com/repos/herb/grouper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/herb/grouper/downloads","issues_url":"https://api.github.com/repos/herb/grouper/issues{/number}","pulls_url":"https://api.github.com/repos/herb/grouper/pulls{/number}","milestones_url":"https://api.github.com/repos/herb/grouper/milestones{/number}","notifications_url":"https://api.github.com/repos/herb/grouper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/herb/grouper/labels{/name}","releases_url":"https://api.github.com/repos/herb/grouper/releases{/id}","deployments_url":"https://api.github.com/repos/herb/grouper/deployments","created_at":"2015-08-05T19:23:19Z","updated_at":"2015-08-05T19:23:20Z","pushed_at":"2016-02-22T22:57:47Z","git_url":"git://github.com/herb/grouper.git","ssh_url":"git@github.com:herb/grouper.git","clone_url":"https://github.com/herb/grouper.git","svn_url":"https://github.com/herb/grouper","homepage":null,"size":638,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dropbox:master","ref":"master","sha":"3b63c3188af90ca5215e3e211be8747e692940b0","user":{"login":"dropbox","id":559357,"avatar_url":"https://avatars.githubusercontent.com/u/559357?v=3","gravatar_id":"","url":"https://api.github.com/users/dropbox","html_url":"https://github.com/dropbox","followers_url":"https://api.github.com/users/dropbox/followers","following_url":"https://api.github.com/users/dropbox/following{/other_user}","gists_url":"https://api.github.com/users/dropbox/gists{/gist_id}","starred_url":"https://api.github.com/users/dropbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropbox/subscriptions","organizations_url":"https://api.github.com/users/dropbox/orgs","repos_url":"https://api.github.com/users/dropbox/repos","events_url":"https://api.github.com/users/dropbox/events{/privacy}","received_events_url":"https://api.github.com/users/dropbox/received_events","type":"Organization","site_admin":false},"repo":{"id":23774982,"name":"grouper","full_name":"dropbox/grouper","owner":{"login":"dropbox","id":559357,"avatar_url":"https://avatars.githubusercontent.com/u/559357?v=3","gravatar_id":"","url":"https://api.github.com/users/dropbox","html_url":"https://github.com/dropbox","followers_url":"https://api.github.com/users/dropbox/followers","following_url":"https://api.github.com/users/dropbox/following{/other_user}","gists_url":"https://api.github.com/users/dropbox/gists{/gist_id}","starred_url":"https://api.github.com/users/dropbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropbox/subscriptions","organizations_url":"https://api.github.com/users/dropbox/orgs","repos_url":"https://api.github.com/users/dropbox/repos","events_url":"https://api.github.com/users/dropbox/events{/privacy}","received_events_url":"https://api.github.com/users/dropbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dropbox/grouper","description":"Group Management Server","fork":false,"url":"https://api.github.com/repos/dropbox/grouper","forks_url":"https://api.github.com/repos/dropbox/grouper/forks","keys_url":"https://api.github.com/repos/dropbox/grouper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dropbox/grouper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dropbox/grouper/teams","hooks_url":"https://api.github.com/repos/dropbox/grouper/hooks","issue_events_url":"https://api.github.com/repos/dropbox/grouper/issues/events{/number}","events_url":"https://api.github.com/repos/dropbox/grouper/events","assignees_url":"https://api.github.com/repos/dropbox/grouper/assignees{/user}","branches_url":"https://api.github.com/repos/dropbox/grouper/branches{/branch}","tags_url":"https://api.github.com/repos/dropbox/grouper/tags","blobs_url":"https://api.github.com/repos/dropbox/grouper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dropbox/grouper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dropbox/grouper/git/refs{/sha}","trees_url":"https://api.github.com/repos/dropbox/grouper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dropbox/grouper/statuses/{sha}","languages_url":"https://api.github.com/repos/dropbox/grouper/languages","stargazers_url":"https://api.github.com/repos/dropbox/grouper/stargazers","contributors_url":"https://api.github.com/repos/dropbox/grouper/contributors","subscribers_url":"https://api.github.com/repos/dropbox/grouper/subscribers","subscription_url":"https://api.github.com/repos/dropbox/grouper/subscription","commits_url":"https://api.github.com/repos/dropbox/grouper/commits{/sha}","git_commits_url":"https://api.github.com/repos/dropbox/grouper/git/commits{/sha}","comments_url":"https://api.github.com/repos/dropbox/grouper/comments{/number}","issue_comment_url":"https://api.github.com/repos/dropbox/grouper/issues/comments{/number}","contents_url":"https://api.github.com/repos/dropbox/grouper/contents/{+path}","compare_url":"https://api.github.com/repos/dropbox/grouper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dropbox/grouper/merges","archive_url":"https://api.github.com/repos/dropbox/grouper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dropbox/grouper/downloads","issues_url":"https://api.github.com/repos/dropbox/grouper/issues{/number}","pulls_url":"https://api.github.com/repos/dropbox/grouper/pulls{/number}","milestones_url":"https://api.github.com/repos/dropbox/grouper/milestones{/number}","notifications_url":"https://api.github.com/repos/dropbox/grouper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dropbox/grouper/labels{/name}","releases_url":"https://api.github.com/repos/dropbox/grouper/releases{/id}","deployments_url":"https://api.github.com/repos/dropbox/grouper/deployments","created_at":"2014-09-08T00:41:17Z","updated_at":"2016-01-12T21:50:45Z","pushed_at":"2016-02-22T22:57:47Z","git_url":"git://github.com/dropbox/grouper.git","ssh_url":"git@github.com:dropbox/grouper.git","clone_url":"https://github.com/dropbox/grouper.git","svn_url":"https://github.com/dropbox/grouper","homepage":null,"size":874,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":2,"forks":8,"open_issues":2,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/156"},"html":{"href":"https://github.com/dropbox/grouper/pull/156"},"issue":{"href":"https://api.github.com/repos/dropbox/grouper/issues/156"},"comments":{"href":"https://api.github.com/repos/dropbox/grouper/issues/156/comments"},"review_comments":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/156/comments"},"review_comment":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dropbox/grouper/pulls/156/commits"},"statuses":{"href":"https://api.github.com/repos/dropbox/grouper/statuses/a3c151bf88aaa9d8f159b4131a4500eb4978f5a9"}}}}