{"action":"created","comment":{"url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/comments/167537002","pull_request_review_id":95768844,"id":167537002,"diff_hunk":"@@ -0,0 +1,180 @@\n+package account\n+\n+import (\n+\t\"context\"\n+\tuuid \"github.com/satori/go.uuid\"\n+)\n+\n+const (\n+\tIdentityResourceTypeOrganization = \"identity/organization\"\n+\tIdentityResourceTypeTeam         = \"identity/team\"\n+\tIdentityResourceTypeGroup        = \"identity/group\"\n+\tIdentityResourceTypeUser         = \"identity/user\"\n+)\n+\n+// This struct is used to return the Organizations for which an Identity is associated\n+type IdentityOrganization struct {\n+\tOrganizationID uuid.UUID\n+\tName           string\n+\tMember         bool\n+\tRoles          []string\n+}\n+\n+// Returns an array of all organizations in which the specified user is a member or is assigned a role\n+func (m *GormIdentityRepository) ListOrganizations(ctx context.Context, identityID uuid.UUID) ([]IdentityOrganization, error) {","path":"account/identity_management.go","position":24,"original_position":24,"commit_id":"c9b48e372d22c75be06d077dfa33e9041195d73d","original_commit_id":"820f0f8163deb084bd0f659d3f240843d17162dc","user":{"login":"sbose78","id":545280,"avatar_url":"https://avatars3.githubusercontent.com/u/545280?v=4","gravatar_id":"","url":"https://api.github.com/users/sbose78","html_url":"https://github.com/sbose78","followers_url":"https://api.github.com/users/sbose78/followers","following_url":"https://api.github.com/users/sbose78/following{/other_user}","gists_url":"https://api.github.com/users/sbose78/gists{/gist_id}","starred_url":"https://api.github.com/users/sbose78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbose78/subscriptions","organizations_url":"https://api.github.com/users/sbose78/orgs","repos_url":"https://api.github.com/users/sbose78/repos","events_url":"https://api.github.com/users/sbose78/events{/privacy}","received_events_url":"https://api.github.com/users/sbose78/received_events","type":"User","site_admin":false},"body":">  how about I look at some way of moving the create organization logic to the repository codebase instead of having it in the controller? \r\n\r\nThat's a great idea irrespective of our conversation around tests. We should abstract out `CreateOrganization(..)` to a repository method !\r\n\r\nIn fact, ( contradictory to a few comments back ) I'm even wondering if we should go with an `OrganizationRepository` which has the two methods `Create(..)` , `List(..)` ? Looks a lot cleaner to me , that way :)\r\n\r\nI am thinking along the lines of having `account/organization.go` .. which would have the  above `OrganizationRepository` definition & methods.","created_at":"2018-02-12T12:09:36Z","updated_at":"2018-02-12T12:09:36Z","html_url":"https://github.com/fabric8-services/fabric8-auth/pull/317#discussion_r167537002","pull_request_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/comments/167537002"},"html":{"href":"https://github.com/fabric8-services/fabric8-auth/pull/317#discussion_r167537002"},"pull_request":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317"}},"in_reply_to_id":167492382},"pull_request":{"url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317","id":166808984,"html_url":"https://github.com/fabric8-services/fabric8-auth/pull/317","diff_url":"https://github.com/fabric8-services/fabric8-auth/pull/317.diff","patch_url":"https://github.com/fabric8-services/fabric8-auth/pull/317.patch","issue_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/317","number":317,"state":"open","locked":false,"title":"ISSUE-290, ISSUE-292 initial code for creating and listing organizations","user":{"login":"sbryzak","id":165507,"avatar_url":"https://avatars0.githubusercontent.com/u/165507?v=4","gravatar_id":"","url":"https://api.github.com/users/sbryzak","html_url":"https://github.com/sbryzak","followers_url":"https://api.github.com/users/sbryzak/followers","following_url":"https://api.github.com/users/sbryzak/following{/other_user}","gists_url":"https://api.github.com/users/sbryzak/gists{/gist_id}","starred_url":"https://api.github.com/users/sbryzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbryzak/subscriptions","organizations_url":"https://api.github.com/users/sbryzak/orgs","repos_url":"https://api.github.com/users/sbryzak/repos","events_url":"https://api.github.com/users/sbryzak/events{/privacy}","received_events_url":"https://api.github.com/users/sbryzak/received_events","type":"User","site_admin":false},"body":"fixes #290 and #292 \r\n\r\nThis PR implements both the create organization and list organization endpoints.\r\n\r\nCreate organization:\r\n\r\n```\r\nPOST /api/organizations\r\nAuthorization: Bearer <token>\r\n\r\n{\"name\":\"Organization Name\"}\r\n```\r\n\r\nResponse:\r\n\r\n`{\"organization-id\": \"ec54103e-962c-4f53-a530-3c5408623c31\"}`\r\n\r\nList organizations:\r\n\r\n```\r\nGET /api/organizations\r\nAuthorization: Bearer <token>\r\n```\r\n\r\nResponse:\r\n\r\n```\r\n{\"data\": [\r\n  {\"id\":\"ec54103e-962c-4f53-a530-3c5408623c31\",\r\n   \"name\":\"Organization Name\",\r\n   \"member\":\"false\",\r\n   \"roles\":[\"owner\"]}\r\n]}\r\n```","created_at":"2018-02-02T13:59:09Z","updated_at":"2018-02-12T12:09:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f736b7869c16ef4e9d84262eb38fb6cb4e61445","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317/commits","review_comments_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317/comments","review_comment_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/317/comments","statuses_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/statuses/c9b48e372d22c75be06d077dfa33e9041195d73d","head":{"label":"sbryzak:ISSUE-290","ref":"ISSUE-290","sha":"c9b48e372d22c75be06d077dfa33e9041195d73d","user":{"login":"sbryzak","id":165507,"avatar_url":"https://avatars0.githubusercontent.com/u/165507?v=4","gravatar_id":"","url":"https://api.github.com/users/sbryzak","html_url":"https://github.com/sbryzak","followers_url":"https://api.github.com/users/sbryzak/followers","following_url":"https://api.github.com/users/sbryzak/following{/other_user}","gists_url":"https://api.github.com/users/sbryzak/gists{/gist_id}","starred_url":"https://api.github.com/users/sbryzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbryzak/subscriptions","organizations_url":"https://api.github.com/users/sbryzak/orgs","repos_url":"https://api.github.com/users/sbryzak/repos","events_url":"https://api.github.com/users/sbryzak/events{/privacy}","received_events_url":"https://api.github.com/users/sbryzak/received_events","type":"User","site_admin":false},"repo":{"id":98956749,"name":"fabric8-auth","full_name":"sbryzak/fabric8-auth","owner":{"login":"sbryzak","id":165507,"avatar_url":"https://avatars0.githubusercontent.com/u/165507?v=4","gravatar_id":"","url":"https://api.github.com/users/sbryzak","html_url":"https://github.com/sbryzak","followers_url":"https://api.github.com/users/sbryzak/followers","following_url":"https://api.github.com/users/sbryzak/following{/other_user}","gists_url":"https://api.github.com/users/sbryzak/gists{/gist_id}","starred_url":"https://api.github.com/users/sbryzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbryzak/subscriptions","organizations_url":"https://api.github.com/users/sbryzak/orgs","repos_url":"https://api.github.com/users/sbryzak/repos","events_url":"https://api.github.com/users/sbryzak/events{/privacy}","received_events_url":"https://api.github.com/users/sbryzak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbryzak/fabric8-auth","description":null,"fork":true,"url":"https://api.github.com/repos/sbryzak/fabric8-auth","forks_url":"https://api.github.com/repos/sbryzak/fabric8-auth/forks","keys_url":"https://api.github.com/repos/sbryzak/fabric8-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbryzak/fabric8-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbryzak/fabric8-auth/teams","hooks_url":"https://api.github.com/repos/sbryzak/fabric8-auth/hooks","issue_events_url":"https://api.github.com/repos/sbryzak/fabric8-auth/issues/events{/number}","events_url":"https://api.github.com/repos/sbryzak/fabric8-auth/events","assignees_url":"https://api.github.com/repos/sbryzak/fabric8-auth/assignees{/user}","branches_url":"https://api.github.com/repos/sbryzak/fabric8-auth/branches{/branch}","tags_url":"https://api.github.com/repos/sbryzak/fabric8-auth/tags","blobs_url":"https://api.github.com/repos/sbryzak/fabric8-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbryzak/fabric8-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbryzak/fabric8-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbryzak/fabric8-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbryzak/fabric8-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/sbryzak/fabric8-auth/languages","stargazers_url":"https://api.github.com/repos/sbryzak/fabric8-auth/stargazers","contributors_url":"https://api.github.com/repos/sbryzak/fabric8-auth/contributors","subscribers_url":"https://api.github.com/repos/sbryzak/fabric8-auth/subscribers","subscription_url":"https://api.github.com/repos/sbryzak/fabric8-auth/subscription","commits_url":"https://api.github.com/repos/sbryzak/fabric8-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbryzak/fabric8-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbryzak/fabric8-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbryzak/fabric8-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbryzak/fabric8-auth/contents/{+path}","compare_url":"https://api.github.com/repos/sbryzak/fabric8-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbryzak/fabric8-auth/merges","archive_url":"https://api.github.com/repos/sbryzak/fabric8-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbryzak/fabric8-auth/downloads","issues_url":"https://api.github.com/repos/sbryzak/fabric8-auth/issues{/number}","pulls_url":"https://api.github.com/repos/sbryzak/fabric8-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/sbryzak/fabric8-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/sbryzak/fabric8-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbryzak/fabric8-auth/labels{/name}","releases_url":"https://api.github.com/repos/sbryzak/fabric8-auth/releases{/id}","deployments_url":"https://api.github.com/repos/sbryzak/fabric8-auth/deployments","created_at":"2017-08-01T03:47:06Z","updated_at":"2017-08-01T03:47:08Z","pushed_at":"2018-02-12T10:14:37Z","git_url":"git://github.com/sbryzak/fabric8-auth.git","ssh_url":"git@github.com:sbryzak/fabric8-auth.git","clone_url":"https://github.com/sbryzak/fabric8-auth.git","svn_url":"https://github.com/sbryzak/fabric8-auth","homepage":null,"size":5372,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fabric8-services:master","ref":"master","sha":"6b0893141456af364b3fb7f441848c6a8b6f51c1","user":{"login":"fabric8-services","id":29751612,"avatar_url":"https://avatars1.githubusercontent.com/u/29751612?v=4","gravatar_id":"","url":"https://api.github.com/users/fabric8-services","html_url":"https://github.com/fabric8-services","followers_url":"https://api.github.com/users/fabric8-services/followers","following_url":"https://api.github.com/users/fabric8-services/following{/other_user}","gists_url":"https://api.github.com/users/fabric8-services/gists{/gist_id}","starred_url":"https://api.github.com/users/fabric8-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabric8-services/subscriptions","organizations_url":"https://api.github.com/users/fabric8-services/orgs","repos_url":"https://api.github.com/users/fabric8-services/repos","events_url":"https://api.github.com/users/fabric8-services/events{/privacy}","received_events_url":"https://api.github.com/users/fabric8-services/received_events","type":"Organization","site_admin":false},"repo":{"id":96831576,"name":"fabric8-auth","full_name":"fabric8-services/fabric8-auth","owner":{"login":"fabric8-services","id":29751612,"avatar_url":"https://avatars1.githubusercontent.com/u/29751612?v=4","gravatar_id":"","url":"https://api.github.com/users/fabric8-services","html_url":"https://github.com/fabric8-services","followers_url":"https://api.github.com/users/fabric8-services/followers","following_url":"https://api.github.com/users/fabric8-services/following{/other_user}","gists_url":"https://api.github.com/users/fabric8-services/gists{/gist_id}","starred_url":"https://api.github.com/users/fabric8-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabric8-services/subscriptions","organizations_url":"https://api.github.com/users/fabric8-services/orgs","repos_url":"https://api.github.com/users/fabric8-services/repos","events_url":"https://api.github.com/users/fabric8-services/events{/privacy}","received_events_url":"https://api.github.com/users/fabric8-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fabric8-services/fabric8-auth","description":"Identity and Access Management for fabric8 services","fork":false,"url":"https://api.github.com/repos/fabric8-services/fabric8-auth","forks_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/forks","keys_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/teams","hooks_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/hooks","issue_events_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/events{/number}","events_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/events","assignees_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/assignees{/user}","branches_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/branches{/branch}","tags_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/tags","blobs_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/languages","stargazers_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/stargazers","contributors_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/contributors","subscribers_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/subscribers","subscription_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/subscription","commits_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/contents/{+path}","compare_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/merges","archive_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/downloads","issues_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues{/number}","pulls_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/labels{/name}","releases_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/releases{/id}","deployments_url":"https://api.github.com/repos/fabric8-services/fabric8-auth/deployments","created_at":"2017-07-10T23:57:55Z","updated_at":"2018-01-24T07:41:43Z","pushed_at":"2018-02-12T10:14:39Z","git_url":"git://github.com/fabric8-services/fabric8-auth.git","ssh_url":"git@github.com:fabric8-services/fabric8-auth.git","clone_url":"https://github.com/fabric8-services/fabric8-auth.git","svn_url":"https://github.com/fabric8-services/fabric8-auth","homepage":"","size":5111,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":15,"open_issues":51,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317"},"html":{"href":"https://github.com/fabric8-services/fabric8-auth/pull/317"},"issue":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/317"},"comments":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/issues/317/comments"},"review_comments":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317/comments"},"review_comment":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/pulls/317/commits"},"statuses":{"href":"https://api.github.com/repos/fabric8-services/fabric8-auth/statuses/c9b48e372d22c75be06d077dfa33e9041195d73d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sbose78"}}