GitHub PullRequestReviewCommentEvent at 2014-07-23 09:40:01
Repository: core
Actor: jboning
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/bravecollective/core/pulls/comments/15279087","id":15279087,"diff_hunk":"@@ -0,0 +1,87 @@\n+# encoding: utf-8\n+\n+from __future__ import unicode_literals\n+\n+from datetime import datetime\n+from mongoengine import Document, EmbeddedDocument, EmbeddedDocumentField, StringField, EmailField, URLField, DateTimeField, BooleanField, ReferenceField, ListField, IntField\n+\n+from brave.core.util.signal import update_modified_timestamp\n+from brave.core.permission.model import Permission, WildcardPermission, GRANT_WILDCARD\n+from brave.core.account.model import User\n+from web.core.http import HTTPForbidden, HTTPUnauthorized\n+from brave.core.util.predicate import authenticate\n+import web.auth\n+\n+\n+log = __import__('logging').getLogger(__name__)\n+\n+\n+def user_has_permission(perm=None, wild=False, **runkw):\n+    \"\"\"wild=True means that any permission that perm would grant will return true.\n+        @user_has_permission('core.group.edit.*', wild=True) would work for any user with the ability to edit anything\n+        about any group (for instance, a user with core.group.edit.acl.bob would be granted access when wild=True, but\n+        not when wild=False.\"\"\"\n+        \n+    def decorator(function):\n+        \n+        @authenticate\n+        def check_permission(self, *args, **kwargs):\n+            user = web.auth.user\n+            \n+            # If there is no permission provided, then any auth'd user has permission\n+            if not perm:\n+                log.debug('No permission provided.')\n+                return function(self, *args, **kwargs)\n+            else:\n+                permission = perm","path":"brave/core/permission/util.py","position":36,"original_position":36,"commit_id":"376a4701b6dab7ada9db93d8bfe1fc91f1835a99","original_commit_id":"376a4701b6dab7ada9db93d8bfe1fc91f1835a99","user":{"login":"jboning","id":376107,"avatar_url":"https://avatars.githubusercontent.com/u/376107?","gravatar_id":"c2efe2ff307854e514b020c70b7f6cf6","url":"https://api.github.com/users/jboning","html_url":"https://github.com/jboning","followers_url":"https://api.github.com/users/jboning/followers","following_url":"https://api.github.com/users/jboning/following{/other_user}","gists_url":"https://api.github.com/users/jboning/gists{/gist_id}","starred_url":"https://api.github.com/users/jboning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboning/subscriptions","organizations_url":"https://api.github.com/users/jboning/orgs","repos_url":"https://api.github.com/users/jboning/repos","events_url":"https://api.github.com/users/jboning/events{/privacy}","received_events_url":"https://api.github.com/users/jboning/received_events","type":"User","site_admin":false},"body":"permission/perm are confusing in this function","created_at":"2014-07-23T09:40:01Z","updated_at":"2014-07-23T09:40:01Z","html_url":"https://github.com/bravecollective/core/pull/271#discussion_r15279087","pull_request_url":"https://api.github.com/repos/bravecollective/core/pulls/271","_links":{"self":{"href":"https://api.github.com/repos/bravecollective/core/pulls/comments/15279087"},"html":{"href":"https://github.com/bravecollective/core/pull/271#discussion_r15279087"},"pull_request":{"href":"https://api.github.com/repos/bravecollective/core/pulls/271"}}},"pull_request":{"url":"https://api.github.com/repos/bravecollective/core/pulls/271","id":18606341,"html_url":"https://github.com/bravecollective/core/pull/271","diff_url":"https://github.com/bravecollective/core/pull/271.diff","patch_url":"https://github.com/bravecollective/core/pull/271.patch","issue_url":"https://api.github.com/repos/bravecollective/core/issues/271","number":271,"state":"open","title":"Implement Permissions checks into Core","user":{"login":"Acidity","id":2623497,"avatar_url":"https://avatars.githubusercontent.com/u/2623497?","gravatar_id":"97cda39a6600b892392c3d94d95d324b","url":"https://api.github.com/users/Acidity","html_url":"https://github.com/Acidity","followers_url":"https://api.github.com/users/Acidity/followers","following_url":"https://api.github.com/users/Acidity/following{/other_user}","gists_url":"https://api.github.com/users/Acidity/gists{/gist_id}","starred_url":"https://api.github.com/users/Acidity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acidity/subscriptions","organizations_url":"https://api.github.com/users/Acidity/orgs","repos_url":"https://api.github.com/users/Acidity/repos","events_url":"https://api.github.com/users/Acidity/events{/privacy}","received_events_url":"https://api.github.com/users/Acidity/received_events","type":"User","site_admin":false},"body":"I may have missed some spots...","created_at":"2014-07-18T20:12:42Z","updated_at":"2014-07-23T09:40:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f673cb3bc726214c758ec7ab44a7203eee352a92","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bravecollective/core/pulls/271/commits","review_comments_url":"https://api.github.com/repos/bravecollective/core/pulls/271/comments","review_comment_url":"https://api.github.com/repos/bravecollective/core/pulls/comments/{number}","comments_url":"https://api.github.com/repos/bravecollective/core/issues/271/comments","statuses_url":"https://api.github.com/repos/bravecollective/core/statuses/376a4701b6dab7ada9db93d8bfe1fc91f1835a99","head":{"label":"Acidity:feature/implementPermissions","ref":"feature/implementPermissions","sha":"376a4701b6dab7ada9db93d8bfe1fc91f1835a99","user":{"login":"Acidity","id":2623497,"avatar_url":"https://avatars.githubusercontent.com/u/2623497?","gravatar_id":"97cda39a6600b892392c3d94d95d324b","url":"https://api.github.com/users/Acidity","html_url":"https://github.com/Acidity","followers_url":"https://api.github.com/users/Acidity/followers","following_url":"https://api.github.com/users/Acidity/following{/other_user}","gists_url":"https://api.github.com/users/Acidity/gists{/gist_id}","starred_url":"https://api.github.com/users/Acidity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acidity/subscriptions","organizations_url":"https://api.github.com/users/Acidity/orgs","repos_url":"https://api.github.com/users/Acidity/repos","events_url":"https://api.github.com/users/Acidity/events{/privacy}","received_events_url":"https://api.github.com/users/Acidity/received_events","type":"User","site_admin":false},"repo":{"id":18019510,"name":"core","full_name":"Acidity/core","owner":{"login":"Acidity","id":2623497,"avatar_url":"https://avatars.githubusercontent.com/u/2623497?","gravatar_id":"97cda39a6600b892392c3d94d95d324b","url":"https://api.github.com/users/Acidity","html_url":"https://github.com/Acidity","followers_url":"https://api.github.com/users/Acidity/followers","following_url":"https://api.github.com/users/Acidity/following{/other_user}","gists_url":"https://api.github.com/users/Acidity/gists{/gist_id}","starred_url":"https://api.github.com/users/Acidity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acidity/subscriptions","organizations_url":"https://api.github.com/users/Acidity/orgs","repos_url":"https://api.github.com/users/Acidity/repos","events_url":"https://api.github.com/users/Acidity/events{/privacy}","received_events_url":"https://api.github.com/users/Acidity/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Acidity/core","description":"Authentication, Authorization, and API Proxy Service","fork":true,"url":"https://api.github.com/repos/Acidity/core","forks_url":"https://api.github.com/repos/Acidity/core/forks","keys_url":"https://api.github.com/repos/Acidity/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Acidity/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Acidity/core/teams","hooks_url":"https://api.github.com/repos/Acidity/core/hooks","issue_events_url":"https://api.github.com/repos/Acidity/core/issues/events{/number}","events_url":"https://api.github.com/repos/Acidity/core/events","assignees_url":"https://api.github.com/repos/Acidity/core/assignees{/user}","branches_url":"https://api.github.com/repos/Acidity/core/branches{/branch}","tags_url":"https://api.github.com/repos/Acidity/core/tags","blobs_url":"https://api.github.com/repos/Acidity/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Acidity/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Acidity/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/Acidity/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Acidity/core/statuses/{sha}","languages_url":"https://api.github.com/repos/Acidity/core/languages","stargazers_url":"https://api.github.com/repos/Acidity/core/stargazers","contributors_url":"https://api.github.com/repos/Acidity/core/contributors","subscribers_url":"https://api.github.com/repos/Acidity/core/subscribers","subscription_url":"https://api.github.com/repos/Acidity/core/subscription","commits_url":"https://api.github.com/repos/Acidity/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/Acidity/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/Acidity/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/Acidity/core/issues/comments/{number}","contents_url":"https://api.github.com/repos/Acidity/core/contents/{+path}","compare_url":"https://api.github.com/repos/Acidity/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Acidity/core/merges","archive_url":"https://api.github.com/repos/Acidity/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Acidity/core/downloads","issues_url":"https://api.github.com/repos/Acidity/core/issues{/number}","pulls_url":"https://api.github.com/repos/Acidity/core/pulls{/number}","milestones_url":"https://api.github.com/repos/Acidity/core/milestones{/number}","notifications_url":"https://api.github.com/repos/Acidity/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Acidity/core/labels{/name}","releases_url":"https://api.github.com/repos/Acidity/core/releases{/id}","created_at":"2014-03-22T20:50:09Z","updated_at":"2014-07-16T06:29:46Z","pushed_at":"2014-07-21T03:58:33Z","git_url":"git://github.com/Acidity/core.git","ssh_url":"git@github.com:Acidity/core.git","clone_url":"https://github.com/Acidity/core.git","svn_url":"https://github.com/Acidity/core","homepage":"","size":14189,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"bravecollective:feature/permissions","ref":"feature/permissions","sha":"b0e10730bcc68aa8bb6e77428ce19995008b0112","user":{"login":"bravecollective","id":5108976,"avatar_url":"https://avatars.githubusercontent.com/u/5108976?","gravatar_id":null,"url":"https://api.github.com/users/bravecollective","html_url":"https://github.com/bravecollective","followers_url":"https://api.github.com/users/bravecollective/followers","following_url":"https://api.github.com/users/bravecollective/following{/other_user}","gists_url":"https://api.github.com/users/bravecollective/gists{/gist_id}","starred_url":"https://api.github.com/users/bravecollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bravecollective/subscriptions","organizations_url":"https://api.github.com/users/bravecollective/orgs","repos_url":"https://api.github.com/users/bravecollective/repos","events_url":"https://api.github.com/users/bravecollective/events{/privacy}","received_events_url":"https://api.github.com/users/bravecollective/received_events","type":"Organization","site_admin":false},"repo":{"id":9990402,"name":"core","full_name":"bravecollective/core","owner":{"login":"bravecollective","id":5108976,"avatar_url":"https://avatars.githubusercontent.com/u/5108976?","gravatar_id":null,"url":"https://api.github.com/users/bravecollective","html_url":"https://github.com/bravecollective","followers_url":"https://api.github.com/users/bravecollective/followers","following_url":"https://api.github.com/users/bravecollective/following{/other_user}","gists_url":"https://api.github.com/users/bravecollective/gists{/gist_id}","starred_url":"https://api.github.com/users/bravecollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bravecollective/subscriptions","organizations_url":"https://api.github.com/users/bravecollective/orgs","repos_url":"https://api.github.com/users/bravecollective/repos","events_url":"https://api.github.com/users/bravecollective/events{/privacy}","received_events_url":"https://api.github.com/users/bravecollective/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bravecollective/core","description":"Authentication, Authorization, and API Proxy Service","fork":false,"url":"https://api.github.com/repos/bravecollective/core","forks_url":"https://api.github.com/repos/bravecollective/core/forks","keys_url":"https://api.github.com/repos/bravecollective/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bravecollective/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bravecollective/core/teams","hooks_url":"https://api.github.com/repos/bravecollective/core/hooks","issue_events_url":"https://api.github.com/repos/bravecollective/core/issues/events{/number}","events_url":"https://api.github.com/repos/bravecollective/core/events","assignees_url":"https://api.github.com/repos/bravecollective/core/assignees{/user}","branches_url":"https://api.github.com/repos/bravecollective/core/branches{/branch}","tags_url":"https://api.github.com/repos/bravecollective/core/tags","blobs_url":"https://api.github.com/repos/bravecollective/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bravecollective/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bravecollective/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/bravecollective/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bravecollective/core/statuses/{sha}","languages_url":"https://api.github.com/repos/bravecollective/core/languages","stargazers_url":"https://api.github.com/repos/bravecollective/core/stargazers","contributors_url":"https://api.github.com/repos/bravecollective/core/contributors","subscribers_url":"https://api.github.com/repos/bravecollective/core/subscribers","subscription_url":"https://api.github.com/repos/bravecollective/core/subscription","commits_url":"https://api.github.com/repos/bravecollective/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/bravecollective/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/bravecollective/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/bravecollective/core/issues/comments/{number}","contents_url":"https://api.github.com/repos/bravecollective/core/contents/{+path}","compare_url":"https://api.github.com/repos/bravecollective/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bravecollective/core/merges","archive_url":"https://api.github.com/repos/bravecollective/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bravecollective/core/downloads","issues_url":"https://api.github.com/repos/bravecollective/core/issues{/number}","pulls_url":"https://api.github.com/repos/bravecollective/core/pulls{/number}","milestones_url":"https://api.github.com/repos/bravecollective/core/milestones{/number}","notifications_url":"https://api.github.com/repos/bravecollective/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bravecollective/core/labels{/name}","releases_url":"https://api.github.com/repos/bravecollective/core/releases{/id}","created_at":"2013-05-10T21:05:37Z","updated_at":"2014-07-06T23:38:54Z","pushed_at":"2014-07-20T19:07:04Z","git_url":"git://github.com/bravecollective/core.git","ssh_url":"git@github.com:bravecollective/core.git","clone_url":"https://github.com/bravecollective/core.git","svn_url":"https://github.com/bravecollective/core","homepage":"https://core.bravecollective.net/","size":18744,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":40,"mirror_url":null,"open_issues_count":38,"forks":40,"open_issues":38,"watchers":23,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/bravecollective/core/pulls/271"},"html":{"href":"https://github.com/bravecollective/core/pull/271"},"issue":{"href":"https://api.github.com/repos/bravecollective/core/issues/271"},"comments":{"href":"https://api.github.com/repos/bravecollective/core/issues/271/comments"},"review_comments":{"href":"https://api.github.com/repos/bravecollective/core/pulls/271/comments"},"review_comment":{"href":"https://api.github.com/repos/bravecollective/core/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/bravecollective/core/pulls/271/commits"},"statuses":{"href":"https://api.github.com/repos/bravecollective/core/statuses/376a4701b6dab7ada9db93d8bfe1fc91f1835a99"}}}}