{"action":"created","comment":{"url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/comments/46901224","id":46901224,"diff_hunk":"@@ -0,0 +1,69 @@\n+class PermissionService\n+  attr_reader :user\n+              :controller\n+              :action\n+\n+  def initialize(user)\n+    @user = user || User.new\n+  end\n+\n+  def allow?(controller, action)\n+    @controller = controller\n+    @action     = action\n+    if user.platform_admin?\n+      return true if controller == 'home'            && action == 'home'\n+      return true if controller == 'sessions'        && action.in?(%w(new create destroy))\n+      return true if controller == 'cars'            && action.in?(%w(index show))\n+      return true if controller == 'locations'       && action.in?(%w(index show))\n+      return true if controller == 'stores/cars'     && action.in?(%w(index show))\n+      return true if controller == 'admin/items'     && action.in?(%w(index show new create destroy))\n+      return true if controller == 'admin/dashboard' && action.in?(%w(index show))\n+      return true if controller == 'admin/locations' && action.in?(%w(index show))\n+      return true if controller == 'users'           && action.in?(%w(show edit update))\n+      return true if controller == 'stores'          && action.in?(%w(index edit))\n+    elsif user.store_admin?\n+      return true if controller == 'home'             && action == 'home'\n+      return true if controller == 'sessions'         && action.in?(%w(new create destroy))\n+      return true if controller == 'cars'             && action.in?(%w(index show))\n+      return true if controller == 'locations'        && action.in?(%w(index show))\n+      return true if controller == 'stores/cars'      && action.in?(%w(index show new create update))\n+      return true if controller == 'stores/dashboard' && action == 'show'\n+    elsif user.registered_user?\n+      return true if controller == 'home'        && action == 'home'\n+      return true if controller == 'sessions'    && action.in?(%w(new create destroy))\n+      return true if controller == 'cars'        && action.in?(%w(index show))\n+      return true if controller == 'locations'   && action.in?(%w(index show))\n+      return true if controller == 'stores/cars' && action.in?(%w(index show))\n+      return true if controller == 'cart_cars'   && action.in?(%w(create destroy update))\n+      return true if controller == 'cart'        && action == 'show'\n+      return true if controller == 'orders'      && action.in?(%w(index create show))\n+      return true if controller == 'users'       && action.in?(%w(show edit update))\n+      return true if controller == 'stores'      && action.in?(%w(new create))\n+    else\n+      return true if controller == 'home'        && action == 'home'\n+      return true if controller == 'sessions'    && action.in?(%w(new create))\n+      return true if controller == 'users'       && action.in?(%w(new create))\n+      return true if controller == 'cars'        && action.in?(%w(index show))\n+      return true if controller == 'locations'   && action.in?(%w(index show))\n+      return true if controller == 'stores/cars' && action.in?(%w(index show))\n+      return true if controller == 'cart'        && action == 'show'\n+      return true if controller == 'cart_cars'   && action.in?(%w(create destroy update))\n+      return true if controller == 'orders'      && action == 'create'","path":"app/services/permission_service.rb","position":51,"original_position":51,"commit_id":"656b41b990f68aaac879788e2ab078a9bd4c9667","original_commit_id":"656b41b990f68aaac879788e2ab078a9bd4c9667","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Operator `&&` should be surrounded with a single space.<br>Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2015-12-08T00:45:21Z","updated_at":"2015-12-08T00:45:21Z","html_url":"https://github.com/edgarduran/the_pivot/pull/27#discussion_r46901224","pull_request_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/comments/46901224"},"html":{"href":"https://github.com/edgarduran/the_pivot/pull/27#discussion_r46901224"},"pull_request":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27","id":52923429,"html_url":"https://github.com/edgarduran/the_pivot/pull/27","diff_url":"https://github.com/edgarduran/the_pivot/pull/27.diff","patch_url":"https://github.com/edgarduran/the_pivot/pull/27.patch","issue_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/27","number":27,"state":"open","locked":false,"title":"Rewrite tests to apply to new project","user":{"login":"dastinnette","id":10576647,"avatar_url":"https://avatars.githubusercontent.com/u/10576647?v=3","gravatar_id":"","url":"https://api.github.com/users/dastinnette","html_url":"https://github.com/dastinnette","followers_url":"https://api.github.com/users/dastinnette/followers","following_url":"https://api.github.com/users/dastinnette/following{/other_user}","gists_url":"https://api.github.com/users/dastinnette/gists{/gist_id}","starred_url":"https://api.github.com/users/dastinnette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dastinnette/subscriptions","organizations_url":"https://api.github.com/users/dastinnette/orgs","repos_url":"https://api.github.com/users/dastinnette/repos","events_url":"https://api.github.com/users/dastinnette/events{/privacy}","received_events_url":"https://api.github.com/users/dastinnette/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-08T00:44:40Z","updated_at":"2015-12-08T00:45:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f8a12fc55bb3e39e4215a7b1cddd3129ddc126b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27/commits","review_comments_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27/comments","review_comment_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/27/comments","statuses_url":"https://api.github.com/repos/edgarduran/the_pivot/statuses/656b41b990f68aaac879788e2ab078a9bd4c9667","head":{"label":"edgarduran:rewrite-tests-to-apply-to-new-project","ref":"rewrite-tests-to-apply-to-new-project","sha":"656b41b990f68aaac879788e2ab078a9bd4c9667","user":{"login":"edgarduran","id":11325650,"avatar_url":"https://avatars.githubusercontent.com/u/11325650?v=3","gravatar_id":"","url":"https://api.github.com/users/edgarduran","html_url":"https://github.com/edgarduran","followers_url":"https://api.github.com/users/edgarduran/followers","following_url":"https://api.github.com/users/edgarduran/following{/other_user}","gists_url":"https://api.github.com/users/edgarduran/gists{/gist_id}","starred_url":"https://api.github.com/users/edgarduran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edgarduran/subscriptions","organizations_url":"https://api.github.com/users/edgarduran/orgs","repos_url":"https://api.github.com/users/edgarduran/repos","events_url":"https://api.github.com/users/edgarduran/events{/privacy}","received_events_url":"https://api.github.com/users/edgarduran/received_events","type":"User","site_admin":false},"repo":{"id":47145511,"name":"the_pivot","full_name":"edgarduran/the_pivot","owner":{"login":"edgarduran","id":11325650,"avatar_url":"https://avatars.githubusercontent.com/u/11325650?v=3","gravatar_id":"","url":"https://api.github.com/users/edgarduran","html_url":"https://github.com/edgarduran","followers_url":"https://api.github.com/users/edgarduran/followers","following_url":"https://api.github.com/users/edgarduran/following{/other_user}","gists_url":"https://api.github.com/users/edgarduran/gists{/gist_id}","starred_url":"https://api.github.com/users/edgarduran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edgarduran/subscriptions","organizations_url":"https://api.github.com/users/edgarduran/orgs","repos_url":"https://api.github.com/users/edgarduran/repos","events_url":"https://api.github.com/users/edgarduran/events{/privacy}","received_events_url":"https://api.github.com/users/edgarduran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edgarduran/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/edgarduran/the_pivot","forks_url":"https://api.github.com/repos/edgarduran/the_pivot/forks","keys_url":"https://api.github.com/repos/edgarduran/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edgarduran/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edgarduran/the_pivot/teams","hooks_url":"https://api.github.com/repos/edgarduran/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/edgarduran/the_pivot/events","assignees_url":"https://api.github.com/repos/edgarduran/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/edgarduran/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/edgarduran/the_pivot/tags","blobs_url":"https://api.github.com/repos/edgarduran/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edgarduran/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edgarduran/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/edgarduran/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edgarduran/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/edgarduran/the_pivot/languages","stargazers_url":"https://api.github.com/repos/edgarduran/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/edgarduran/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/edgarduran/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/edgarduran/the_pivot/subscription","commits_url":"https://api.github.com/repos/edgarduran/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/edgarduran/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/edgarduran/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/edgarduran/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/edgarduran/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edgarduran/the_pivot/merges","archive_url":"https://api.github.com/repos/edgarduran/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edgarduran/the_pivot/downloads","issues_url":"https://api.github.com/repos/edgarduran/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/edgarduran/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/edgarduran/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edgarduran/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/edgarduran/the_pivot/releases{/id}","created_at":"2015-11-30T20:56:41Z","updated_at":"2015-11-30T20:59:48Z","pushed_at":"2015-12-08T00:44:41Z","git_url":"git://github.com/edgarduran/the_pivot.git","ssh_url":"git@github.com:edgarduran/the_pivot.git","clone_url":"https://github.com/edgarduran/the_pivot.git","svn_url":"https://github.com/edgarduran/the_pivot","homepage":null,"size":16936,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":9,"forks":1,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"edgarduran:master","ref":"master","sha":"0c03ba261848f3ff19fa4d06d5dea23bac15fc8f","user":{"login":"edgarduran","id":11325650,"avatar_url":"https://avatars.githubusercontent.com/u/11325650?v=3","gravatar_id":"","url":"https://api.github.com/users/edgarduran","html_url":"https://github.com/edgarduran","followers_url":"https://api.github.com/users/edgarduran/followers","following_url":"https://api.github.com/users/edgarduran/following{/other_user}","gists_url":"https://api.github.com/users/edgarduran/gists{/gist_id}","starred_url":"https://api.github.com/users/edgarduran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edgarduran/subscriptions","organizations_url":"https://api.github.com/users/edgarduran/orgs","repos_url":"https://api.github.com/users/edgarduran/repos","events_url":"https://api.github.com/users/edgarduran/events{/privacy}","received_events_url":"https://api.github.com/users/edgarduran/received_events","type":"User","site_admin":false},"repo":{"id":47145511,"name":"the_pivot","full_name":"edgarduran/the_pivot","owner":{"login":"edgarduran","id":11325650,"avatar_url":"https://avatars.githubusercontent.com/u/11325650?v=3","gravatar_id":"","url":"https://api.github.com/users/edgarduran","html_url":"https://github.com/edgarduran","followers_url":"https://api.github.com/users/edgarduran/followers","following_url":"https://api.github.com/users/edgarduran/following{/other_user}","gists_url":"https://api.github.com/users/edgarduran/gists{/gist_id}","starred_url":"https://api.github.com/users/edgarduran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edgarduran/subscriptions","organizations_url":"https://api.github.com/users/edgarduran/orgs","repos_url":"https://api.github.com/users/edgarduran/repos","events_url":"https://api.github.com/users/edgarduran/events{/privacy}","received_events_url":"https://api.github.com/users/edgarduran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edgarduran/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/edgarduran/the_pivot","forks_url":"https://api.github.com/repos/edgarduran/the_pivot/forks","keys_url":"https://api.github.com/repos/edgarduran/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edgarduran/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edgarduran/the_pivot/teams","hooks_url":"https://api.github.com/repos/edgarduran/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/edgarduran/the_pivot/events","assignees_url":"https://api.github.com/repos/edgarduran/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/edgarduran/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/edgarduran/the_pivot/tags","blobs_url":"https://api.github.com/repos/edgarduran/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edgarduran/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edgarduran/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/edgarduran/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edgarduran/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/edgarduran/the_pivot/languages","stargazers_url":"https://api.github.com/repos/edgarduran/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/edgarduran/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/edgarduran/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/edgarduran/the_pivot/subscription","commits_url":"https://api.github.com/repos/edgarduran/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/edgarduran/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/edgarduran/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/edgarduran/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/edgarduran/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/edgarduran/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edgarduran/the_pivot/merges","archive_url":"https://api.github.com/repos/edgarduran/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edgarduran/the_pivot/downloads","issues_url":"https://api.github.com/repos/edgarduran/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/edgarduran/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/edgarduran/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/edgarduran/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edgarduran/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/edgarduran/the_pivot/releases{/id}","created_at":"2015-11-30T20:56:41Z","updated_at":"2015-11-30T20:59:48Z","pushed_at":"2015-12-08T00:44:41Z","git_url":"git://github.com/edgarduran/the_pivot.git","ssh_url":"git@github.com:edgarduran/the_pivot.git","clone_url":"https://github.com/edgarduran/the_pivot.git","svn_url":"https://github.com/edgarduran/the_pivot","homepage":null,"size":16936,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":9,"forks":1,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27"},"html":{"href":"https://github.com/edgarduran/the_pivot/pull/27"},"issue":{"href":"https://api.github.com/repos/edgarduran/the_pivot/issues/27"},"comments":{"href":"https://api.github.com/repos/edgarduran/the_pivot/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edgarduran/the_pivot/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/edgarduran/the_pivot/statuses/656b41b990f68aaac879788e2ab078a9bd4c9667"}}}}