{"action":"created","comment":{"url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/comments/99893474","pull_request_review_id":20582838,"id":99893474,"diff_hunk":"@@ -0,0 +1,101 @@\n+module Decidim\n+  # This class is used to authorize a user against an action in the context of a\n+  # feature.\n+  class ActionAuthorizer\n+    include Wisper::Publisher\n+\n+    # Initializes the ActionAuthorizer.\n+    #\n+    # user    - The user to authorize against.\n+    # feature - The feature to authenticate against.\n+    # action  - The action to authenticate.\n+    def initialize(user, feature, action)\n+      @user = user\n+      @feature = feature\n+      @action = action.to_s if action\n+    end\n+\n+    # Public: Broadcasts different events given the status of the authentication.\n+    #\n+    # Broadcasts:\n+    #   failed       - When no valid authorization can be found.\n+    #   unauthorized - When an authorization was found, but didn't match the credentials.\n+    #   incomplete   - An authorization was found, but lacks some required fields. User\n+    #                  should re-authenticate.\n+    #\n+    # Returns nil.\n+    def authorize\n+      raise AuthorizationError, \"Missing data\" unless feature && action","path":"decidim-core/app/services/decidim/action_authorizer.rb","position":28,"original_position":28,"commit_id":"3ece7ba1c8ffbf3d5b7496e11d3fa890f8ae3ae6","original_commit_id":"bb9c24fb3cff6beb5a1661fab0f72c396385b33f","user":{"login":"josepjaume","id":111746,"avatar_url":"https://avatars.githubusercontent.com/u/111746?v=3","gravatar_id":"","url":"https://api.github.com/users/josepjaume","html_url":"https://github.com/josepjaume","followers_url":"https://api.github.com/users/josepjaume/followers","following_url":"https://api.github.com/users/josepjaume/following{/other_user}","gists_url":"https://api.github.com/users/josepjaume/gists{/gist_id}","starred_url":"https://api.github.com/users/josepjaume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josepjaume/subscriptions","organizations_url":"https://api.github.com/users/josepjaume/orgs","repos_url":"https://api.github.com/users/josepjaume/repos","events_url":"https://api.github.com/users/josepjaume/events{/privacy}","received_events_url":"https://api.github.com/users/josepjaume/received_events","type":"User","site_admin":false},"body":"This shouldn't be rescued, it's a failure","created_at":"2017-02-07T18:30:58Z","updated_at":"2017-02-07T18:30:58Z","html_url":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708#discussion_r99893474","pull_request_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708","_links":{"self":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/comments/99893474"},"html":{"href":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708#discussion_r99893474"},"pull_request":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708"}}},"pull_request":{"url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708","id":103972855,"html_url":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708","diff_url":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708.diff","patch_url":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708.patch","issue_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/708","number":708,"state":"open","locked":false,"title":"Action permissions","user":{"login":"josepjaume","id":111746,"avatar_url":"https://avatars.githubusercontent.com/u/111746?v=3","gravatar_id":"","url":"https://api.github.com/users/josepjaume","html_url":"https://github.com/josepjaume","followers_url":"https://api.github.com/users/josepjaume/followers","following_url":"https://api.github.com/users/josepjaume/following{/other_user}","gists_url":"https://api.github.com/users/josepjaume/gists{/gist_id}","starred_url":"https://api.github.com/users/josepjaume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josepjaume/subscriptions","organizations_url":"https://api.github.com/users/josepjaume/orgs","repos_url":"https://api.github.com/users/josepjaume/repos","events_url":"https://api.github.com/users/josepjaume/events{/privacy}","received_events_url":"https://api.github.com/users/josepjaume/received_events","type":"User","site_admin":false},"body":"#### :tophat: What? Why?\r\nPreliminary work on adding action permissions.\r\n\r\n#### :pushpin: Related Issues\r\n*None*\r\n\r\n#### :clipboard: Subtasks\r\n*None*\r\n\r\n### :camera: Screenshots (optional)\r\n*None*\r\n\r\n#### :ghost: GIF\r\n![](https://media.giphy.com/media/CFPeiD6w0WXVm/giphy.gif)\r\n","created_at":"2017-01-31T16:34:06Z","updated_at":"2017-02-07T18:30:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d6cb3149591ef0585fbf61ea268a882921b4469","assignee":{"login":"josepjaume","id":111746,"avatar_url":"https://avatars.githubusercontent.com/u/111746?v=3","gravatar_id":"","url":"https://api.github.com/users/josepjaume","html_url":"https://github.com/josepjaume","followers_url":"https://api.github.com/users/josepjaume/followers","following_url":"https://api.github.com/users/josepjaume/following{/other_user}","gists_url":"https://api.github.com/users/josepjaume/gists{/gist_id}","starred_url":"https://api.github.com/users/josepjaume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josepjaume/subscriptions","organizations_url":"https://api.github.com/users/josepjaume/orgs","repos_url":"https://api.github.com/users/josepjaume/repos","events_url":"https://api.github.com/users/josepjaume/events{/privacy}","received_events_url":"https://api.github.com/users/josepjaume/received_events","type":"User","site_admin":false},"assignees":[{"login":"josepjaume","id":111746,"avatar_url":"https://avatars.githubusercontent.com/u/111746?v=3","gravatar_id":"","url":"https://api.github.com/users/josepjaume","html_url":"https://github.com/josepjaume","followers_url":"https://api.github.com/users/josepjaume/followers","following_url":"https://api.github.com/users/josepjaume/following{/other_user}","gists_url":"https://api.github.com/users/josepjaume/gists{/gist_id}","starred_url":"https://api.github.com/users/josepjaume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josepjaume/subscriptions","organizations_url":"https://api.github.com/users/josepjaume/orgs","repos_url":"https://api.github.com/users/josepjaume/repos","events_url":"https://api.github.com/users/josepjaume/events{/privacy}","received_events_url":"https://api.github.com/users/josepjaume/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708/commits","review_comments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708/comments","review_comment_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/708/comments","statuses_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/statuses/3ece7ba1c8ffbf3d5b7496e11d3fa890f8ae3ae6","head":{"label":"AjuntamentdeBarcelona:action_permissions","ref":"action_permissions","sha":"3ece7ba1c8ffbf3d5b7496e11d3fa890f8ae3ae6","user":{"login":"AjuntamentdeBarcelona","id":16301934,"avatar_url":"https://avatars.githubusercontent.com/u/16301934?v=3","gravatar_id":"","url":"https://api.github.com/users/AjuntamentdeBarcelona","html_url":"https://github.com/AjuntamentdeBarcelona","followers_url":"https://api.github.com/users/AjuntamentdeBarcelona/followers","following_url":"https://api.github.com/users/AjuntamentdeBarcelona/following{/other_user}","gists_url":"https://api.github.com/users/AjuntamentdeBarcelona/gists{/gist_id}","starred_url":"https://api.github.com/users/AjuntamentdeBarcelona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AjuntamentdeBarcelona/subscriptions","organizations_url":"https://api.github.com/users/AjuntamentdeBarcelona/orgs","repos_url":"https://api.github.com/users/AjuntamentdeBarcelona/repos","events_url":"https://api.github.com/users/AjuntamentdeBarcelona/events{/privacy}","received_events_url":"https://api.github.com/users/AjuntamentdeBarcelona/received_events","type":"Organization","site_admin":false},"repo":{"id":65914086,"name":"decidim","full_name":"AjuntamentdeBarcelona/decidim","owner":{"login":"AjuntamentdeBarcelona","id":16301934,"avatar_url":"https://avatars.githubusercontent.com/u/16301934?v=3","gravatar_id":"","url":"https://api.github.com/users/AjuntamentdeBarcelona","html_url":"https://github.com/AjuntamentdeBarcelona","followers_url":"https://api.github.com/users/AjuntamentdeBarcelona/followers","following_url":"https://api.github.com/users/AjuntamentdeBarcelona/following{/other_user}","gists_url":"https://api.github.com/users/AjuntamentdeBarcelona/gists{/gist_id}","starred_url":"https://api.github.com/users/AjuntamentdeBarcelona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AjuntamentdeBarcelona/subscriptions","organizations_url":"https://api.github.com/users/AjuntamentdeBarcelona/orgs","repos_url":"https://api.github.com/users/AjuntamentdeBarcelona/repos","events_url":"https://api.github.com/users/AjuntamentdeBarcelona/events{/privacy}","received_events_url":"https://api.github.com/users/AjuntamentdeBarcelona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AjuntamentdeBarcelona/decidim","description":"The participatory democracy framework","fork":false,"url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim","forks_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/forks","keys_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/teams","hooks_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/hooks","issue_events_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/events{/number}","events_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/events","assignees_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/assignees{/user}","branches_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/branches{/branch}","tags_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/tags","blobs_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/refs{/sha}","trees_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/statuses/{sha}","languages_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/languages","stargazers_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/stargazers","contributors_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/contributors","subscribers_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/subscribers","subscription_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/subscription","commits_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/commits{/sha}","git_commits_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/commits{/sha}","comments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/comments{/number}","issue_comment_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/comments{/number}","contents_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/contents/{+path}","compare_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/merges","archive_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/downloads","issues_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues{/number}","pulls_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls{/number}","milestones_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/milestones{/number}","notifications_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/labels{/name}","releases_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/releases{/id}","deployments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/deployments","created_at":"2016-08-17T14:27:06Z","updated_at":"2017-02-04T21:48:59Z","pushed_at":"2017-02-07T18:15:50Z","git_url":"git://github.com/AjuntamentdeBarcelona/decidim.git","ssh_url":"git@github.com:AjuntamentdeBarcelona/decidim.git","clone_url":"https://github.com/AjuntamentdeBarcelona/decidim.git","svn_url":"https://github.com/AjuntamentdeBarcelona/decidim","homepage":"","size":7403,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":96,"forks":4,"open_issues":96,"watchers":15,"default_branch":"master"}},"base":{"label":"AjuntamentdeBarcelona:master","ref":"master","sha":"989e4705d901fc86d9b1b6449064195c290cac8f","user":{"login":"AjuntamentdeBarcelona","id":16301934,"avatar_url":"https://avatars.githubusercontent.com/u/16301934?v=3","gravatar_id":"","url":"https://api.github.com/users/AjuntamentdeBarcelona","html_url":"https://github.com/AjuntamentdeBarcelona","followers_url":"https://api.github.com/users/AjuntamentdeBarcelona/followers","following_url":"https://api.github.com/users/AjuntamentdeBarcelona/following{/other_user}","gists_url":"https://api.github.com/users/AjuntamentdeBarcelona/gists{/gist_id}","starred_url":"https://api.github.com/users/AjuntamentdeBarcelona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AjuntamentdeBarcelona/subscriptions","organizations_url":"https://api.github.com/users/AjuntamentdeBarcelona/orgs","repos_url":"https://api.github.com/users/AjuntamentdeBarcelona/repos","events_url":"https://api.github.com/users/AjuntamentdeBarcelona/events{/privacy}","received_events_url":"https://api.github.com/users/AjuntamentdeBarcelona/received_events","type":"Organization","site_admin":false},"repo":{"id":65914086,"name":"decidim","full_name":"AjuntamentdeBarcelona/decidim","owner":{"login":"AjuntamentdeBarcelona","id":16301934,"avatar_url":"https://avatars.githubusercontent.com/u/16301934?v=3","gravatar_id":"","url":"https://api.github.com/users/AjuntamentdeBarcelona","html_url":"https://github.com/AjuntamentdeBarcelona","followers_url":"https://api.github.com/users/AjuntamentdeBarcelona/followers","following_url":"https://api.github.com/users/AjuntamentdeBarcelona/following{/other_user}","gists_url":"https://api.github.com/users/AjuntamentdeBarcelona/gists{/gist_id}","starred_url":"https://api.github.com/users/AjuntamentdeBarcelona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AjuntamentdeBarcelona/subscriptions","organizations_url":"https://api.github.com/users/AjuntamentdeBarcelona/orgs","repos_url":"https://api.github.com/users/AjuntamentdeBarcelona/repos","events_url":"https://api.github.com/users/AjuntamentdeBarcelona/events{/privacy}","received_events_url":"https://api.github.com/users/AjuntamentdeBarcelona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AjuntamentdeBarcelona/decidim","description":"The participatory democracy framework","fork":false,"url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim","forks_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/forks","keys_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/teams","hooks_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/hooks","issue_events_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/events{/number}","events_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/events","assignees_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/assignees{/user}","branches_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/branches{/branch}","tags_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/tags","blobs_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/refs{/sha}","trees_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/statuses/{sha}","languages_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/languages","stargazers_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/stargazers","contributors_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/contributors","subscribers_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/subscribers","subscription_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/subscription","commits_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/commits{/sha}","git_commits_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/git/commits{/sha}","comments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/comments{/number}","issue_comment_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/comments{/number}","contents_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/contents/{+path}","compare_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/merges","archive_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/downloads","issues_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues{/number}","pulls_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls{/number}","milestones_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/milestones{/number}","notifications_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/labels{/name}","releases_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/releases{/id}","deployments_url":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/deployments","created_at":"2016-08-17T14:27:06Z","updated_at":"2017-02-04T21:48:59Z","pushed_at":"2017-02-07T18:15:50Z","git_url":"git://github.com/AjuntamentdeBarcelona/decidim.git","ssh_url":"git@github.com:AjuntamentdeBarcelona/decidim.git","clone_url":"https://github.com/AjuntamentdeBarcelona/decidim.git","svn_url":"https://github.com/AjuntamentdeBarcelona/decidim","homepage":"","size":7403,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":96,"forks":4,"open_issues":96,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708"},"html":{"href":"https://github.com/AjuntamentdeBarcelona/decidim/pull/708"},"issue":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/708"},"comments":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/issues/708/comments"},"review_comments":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708/comments"},"review_comment":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/pulls/708/commits"},"statuses":{"href":"https://api.github.com/repos/AjuntamentdeBarcelona/decidim/statuses/3ece7ba1c8ffbf3d5b7496e11d3fa890f8ae3ae6"}}}}
{"actor":{"display_login":"josepjaume"}}