{"action":"created","comment":{"url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/comments/32417160","id":32417160,"diff_hunk":"@@ -0,0 +1,45 @@\n+class RoleLoader\n+\n+  def available_roles_for_application(name)","path":"app/models/role_loader.rb","position":3,"original_position":3,"commit_id":"1ed60639d2645043f587bcfbc5e23f1f111790cd","original_commit_id":"1ed60639d2645043f587bcfbc5e23f1f111790cd","user":{"login":"ansonK","id":722405,"avatar_url":"https://avatars.githubusercontent.com/u/722405?v=3","gravatar_id":"","url":"https://api.github.com/users/ansonK","html_url":"https://github.com/ansonK","followers_url":"https://api.github.com/users/ansonK/followers","following_url":"https://api.github.com/users/ansonK/following{/other_user}","gists_url":"https://api.github.com/users/ansonK/gists{/gist_id}","starred_url":"https://api.github.com/users/ansonK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansonK/subscriptions","organizations_url":"https://api.github.com/users/ansonK/orgs","repos_url":"https://api.github.com/users/ansonK/repos","events_url":"https://api.github.com/users/ansonK/events{/privacy}","received_events_url":"https://api.github.com/users/ansonK/received_events","type":"User","site_admin":false},"body":"Yes we do.\r\nWhen a User is logging in the provider checks that the User holds at least 1 role that the Application supports (otherwise no access_token is issued).\r\nIn this case it doesn't matter which Organisation the User belongs to, just that they have one of the available roles","created_at":"2015-06-15T13:09:35Z","updated_at":"2015-06-15T13:09:35Z","html_url":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99#discussion_r32417160","pull_request_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/comments/32417160"},"html":{"href":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99#discussion_r32417160"},"pull_request":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99","id":37648354,"html_url":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99","diff_url":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99.diff","patch_url":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99.patch","issue_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/99","number":99,"state":"open","locked":false,"title":"WIP: New organisation based schema","user":{"login":"ansonK","id":722405,"avatar_url":"https://avatars.githubusercontent.com/u/722405?v=3","gravatar_id":"","url":"https://api.github.com/users/ansonK","html_url":"https://github.com/ansonK","followers_url":"https://api.github.com/users/ansonK/followers","following_url":"https://api.github.com/users/ansonK/following{/other_user}","gists_url":"https://api.github.com/users/ansonK/gists{/gist_id}","starred_url":"https://api.github.com/users/ansonK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansonK/subscriptions","organizations_url":"https://api.github.com/users/ansonK/orgs","repos_url":"https://api.github.com/users/ansonK/repos","events_url":"https://api.github.com/users/ansonK/events{/privacy}","received_events_url":"https://api.github.com/users/ansonK/received_events","type":"User","site_admin":false},"body":"Rationalises schema to be 3 main models: User, Membership and Organisation\r\nMemberships link Users to Organisations, and define which roles a User performs in each Organisation they belong to\r\n\r\nPundit is used to control access - a User can update their own information but only a User with an admin role in an Organisation can create Users and modify other Users in their Organisation \r\n\r\nAccess to consuming Applications is defined in terms of organisation types - the Organisations a User belongs_to determines which Applications they can log in to.\r\nEach User can have 1 or more roles for each Application","created_at":"2015-06-14T20:59:55Z","updated_at":"2015-06-15T13:09:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84577545e7b73b94c0f02d3f04cb862402b20eff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99/commits","review_comments_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99/comments","review_comment_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/99/comments","statuses_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/statuses/1ed60639d2645043f587bcfbc5e23f1f111790cd","head":{"label":"ministryofjustice:new-organisation-based-schema","ref":"new-organisation-based-schema","sha":"1ed60639d2645043f587bcfbc5e23f1f111790cd","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":32030127,"name":"defence-request-service-auth","full_name":"ministryofjustice/defence-request-service-auth","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/defence-request-service-auth","description":"DSDS - Defence Solicitor Request Service - Directory Service","fork":false,"url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth","forks_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/forks","keys_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/events","assignees_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/merges","archive_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/releases{/id}","created_at":"2015-03-11T17:03:26Z","updated_at":"2015-05-08T15:14:32Z","pushed_at":"2015-06-15T12:42:52Z","git_url":"git://github.com/ministryofjustice/defence-request-service-auth.git","ssh_url":"git@github.com:ministryofjustice/defence-request-service-auth.git","clone_url":"https://github.com/ministryofjustice/defence-request-service-auth.git","svn_url":"https://github.com/ministryofjustice/defence-request-service-auth","homepage":"","size":27668,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"ministryofjustice:master","ref":"master","sha":"d4f76a93eac92205ea6d11dea6465addab152f47","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":32030127,"name":"defence-request-service-auth","full_name":"ministryofjustice/defence-request-service-auth","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/defence-request-service-auth","description":"DSDS - Defence Solicitor Request Service - Directory Service","fork":false,"url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth","forks_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/forks","keys_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/events","assignees_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/merges","archive_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/releases{/id}","created_at":"2015-03-11T17:03:26Z","updated_at":"2015-05-08T15:14:32Z","pushed_at":"2015-06-15T12:42:52Z","git_url":"git://github.com/ministryofjustice/defence-request-service-auth.git","ssh_url":"git@github.com:ministryofjustice/defence-request-service-auth.git","clone_url":"https://github.com/ministryofjustice/defence-request-service-auth.git","svn_url":"https://github.com/ministryofjustice/defence-request-service-auth","homepage":"","size":27668,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99"},"html":{"href":"https://github.com/ministryofjustice/defence-request-service-auth/pull/99"},"issue":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/99"},"comments":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/ministryofjustice/defence-request-service-auth/statuses/1ed60639d2645043f587bcfbc5e23f1f111790cd"}}}}