{"action":"created","comment":{"url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/comments/238054052","pull_request_review_id":180513502,"id":238054052,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODA1NDA1Mg==","diff_hunk":"@@ -49,6 +50,102 @@ func NewUsersController(service *goa.Service, db application.DB, config UsersCon\n \t\tconfig:     config,\n \t}\n }\n+func randString(n int) string {\n+\tconst letterBytes = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n+\tb := make([]byte, n)\n+\tfor i := range b {\n+\t\tb[i] = letterBytes[rand.Int63()%int64(len(letterBytes))]\n+\t}\n+\treturn string(b)\n+}\n+\n+// Obfuscate runs the obfuscate action to soft delete sensitive data associated\n+// with an user and her associated identity.\n+func (c *UsersController) Obfuscate(ctx *app.ObfuscateUsersContext) error {\n+\tisSvcAccount, err := isServiceAccount(ctx, serviceNameAuth)\n+\tif err != nil {\n+\t\tlog.Error(ctx, map[string]interface{}{\n+\t\t\t\"err\": err,\n+\t\t}, \"failed to determine if account is a service account\")\n+\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err))\n+\n+\t}\n+\tif !isSvcAccount {\n+\t\tlog.Error(ctx, map[string]interface{}{\n+\t\t\t\"identity_id\": ctx.ID,\n+\t\t}, \"account used to call create api is not a service account\")\n+\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(errs.New(\"a non-service account tried to create a user.\")))\n+\t}\n+\tu, err := uuid.FromString(ctx.ID)\n+\tif err != nil {\n+\t\tlog.Error(ctx, map[string]interface{}{\n+\t\t\t\"err\": err,\n+\t\t}, \"failed to convert user id in valid uuid\")\n+\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrBadRequest(errs.New(\"invalid user id\")))\n+\n+\t}\n+\treturnResponse := application.Transactional(c.db, func(appl application.Application) error {\n+\t\tobfStr := randString(12)\n+\n+\t\t// Obfuscate User\n+\t\tusers, err := appl.Users().Query(account.UserFilterByID(u))","path":"controller/users.go","position":50,"original_position":50,"commit_id":"268a4fa3f0b1c93b6d33a76f07b0d3b9933425a6","original_commit_id":"268a4fa3f0b1c93b6d33a76f07b0d3b9933425a6","user":{"login":"jarifibrahim","id":12949454,"node_id":"MDQ6VXNlcjEyOTQ5NDU0","avatar_url":"https://avatars3.githubusercontent.com/u/12949454?v=4","gravatar_id":"","url":"https://api.github.com/users/jarifibrahim","html_url":"https://github.com/jarifibrahim","followers_url":"https://api.github.com/users/jarifibrahim/followers","following_url":"https://api.github.com/users/jarifibrahim/following{/other_user}","gists_url":"https://api.github.com/users/jarifibrahim/gists{/gist_id}","starred_url":"https://api.github.com/users/jarifibrahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarifibrahim/subscriptions","organizations_url":"https://api.github.com/users/jarifibrahim/orgs","repos_url":"https://api.github.com/users/jarifibrahim/repos","events_url":"https://api.github.com/users/jarifibrahim/events{/privacy}","received_events_url":"https://api.github.com/users/jarifibrahim/received_events","type":"User","site_admin":false},"body":"@corinnekrych is there a reason why you chose to use \r\n```\r\nappl.Users().Query(account.UserFilterByID(u))\r\n```\r\ninstead of \r\n```\r\nappl.Users().Load(ctx, u)\r\n```\r\n?\r\n","created_at":"2018-12-01T06:15:57Z","updated_at":"2018-12-01T06:45:22Z","html_url":"https://github.com/fabric8-services/fabric8-wit/pull/2358#discussion_r238054052","pull_request_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/comments/238054052"},"html":{"href":"https://github.com/fabric8-services/fabric8-wit/pull/2358#discussion_r238054052"},"pull_request":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358"}}},"pull_request":{"url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358","id":234568679,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NTY4Njc5","html_url":"https://github.com/fabric8-services/fabric8-wit/pull/2358","diff_url":"https://github.com/fabric8-services/fabric8-wit/pull/2358.diff","patch_url":"https://github.com/fabric8-services/fabric8-wit/pull/2358.patch","issue_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/2358","number":2358,"state":"open","locked":false,"title":"Expose API to update/obfuscate user details in the DB","user":{"login":"corinnekrych","id":1395710,"node_id":"MDQ6VXNlcjEzOTU3MTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1395710?v=4","gravatar_id":"","url":"https://api.github.com/users/corinnekrych","html_url":"https://github.com/corinnekrych","followers_url":"https://api.github.com/users/corinnekrych/followers","following_url":"https://api.github.com/users/corinnekrych/following{/other_user}","gists_url":"https://api.github.com/users/corinnekrych/gists{/gist_id}","starred_url":"https://api.github.com/users/corinnekrych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corinnekrych/subscriptions","organizations_url":"https://api.github.com/users/corinnekrych/orgs","repos_url":"https://api.github.com/users/corinnekrych/repos","events_url":"https://api.github.com/users/corinnekrych/events{/privacy}","received_events_url":"https://api.github.com/users/corinnekrych/received_events","type":"User","site_admin":false},"body":"* Please describe what your change is about.\r\nThis PR provide a WIT API to obfuscate user and identity information.\r\n\r\n* What issues does it solve? (Use [autoreferencing for this](https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests))\r\n[OSIO 804](https://openshift.io/openshiftio/Openshift_io/plan/detail/804)\r\nBackground: https://gitlab.cee.redhat.com/dtsd/housekeeping/issues/2108\r\n","created_at":"2018-11-29T09:43:30Z","updated_at":"2018-12-01T06:45:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a73f669bea6d4e323e5355f8bfa3dc1a90aa32e4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tinakurian","id":40298444,"node_id":"MDQ6VXNlcjQwMjk4NDQ0","avatar_url":"https://avatars1.githubusercontent.com/u/40298444?v=4","gravatar_id":"","url":"https://api.github.com/users/tinakurian","html_url":"https://github.com/tinakurian","followers_url":"https://api.github.com/users/tinakurian/followers","following_url":"https://api.github.com/users/tinakurian/following{/other_user}","gists_url":"https://api.github.com/users/tinakurian/gists{/gist_id}","starred_url":"https://api.github.com/users/tinakurian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinakurian/subscriptions","organizations_url":"https://api.github.com/users/tinakurian/orgs","repos_url":"https://api.github.com/users/tinakurian/repos","events_url":"https://api.github.com/users/tinakurian/events{/privacy}","received_events_url":"https://api.github.com/users/tinakurian/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358/commits","review_comments_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358/comments","review_comment_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/2358/comments","statuses_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/statuses/268a4fa3f0b1c93b6d33a76f07b0d3b9933425a6","head":{"label":"corinnekrych:osio.804.add.wit.api.to.obfuscate","ref":"osio.804.add.wit.api.to.obfuscate","sha":"268a4fa3f0b1c93b6d33a76f07b0d3b9933425a6","user":{"login":"corinnekrych","id":1395710,"node_id":"MDQ6VXNlcjEzOTU3MTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1395710?v=4","gravatar_id":"","url":"https://api.github.com/users/corinnekrych","html_url":"https://github.com/corinnekrych","followers_url":"https://api.github.com/users/corinnekrych/followers","following_url":"https://api.github.com/users/corinnekrych/following{/other_user}","gists_url":"https://api.github.com/users/corinnekrych/gists{/gist_id}","starred_url":"https://api.github.com/users/corinnekrych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corinnekrych/subscriptions","organizations_url":"https://api.github.com/users/corinnekrych/orgs","repos_url":"https://api.github.com/users/corinnekrych/repos","events_url":"https://api.github.com/users/corinnekrych/events{/privacy}","received_events_url":"https://api.github.com/users/corinnekrych/received_events","type":"User","site_admin":false},"repo":{"id":93515217,"node_id":"MDEwOlJlcG9zaXRvcnk5MzUxNTIxNw==","name":"almighty-core","full_name":"corinnekrych/almighty-core","private":false,"owner":{"login":"corinnekrych","id":1395710,"node_id":"MDQ6VXNlcjEzOTU3MTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1395710?v=4","gravatar_id":"","url":"https://api.github.com/users/corinnekrych","html_url":"https://github.com/corinnekrych","followers_url":"https://api.github.com/users/corinnekrych/followers","following_url":"https://api.github.com/users/corinnekrych/following{/other_user}","gists_url":"https://api.github.com/users/corinnekrych/gists{/gist_id}","starred_url":"https://api.github.com/users/corinnekrych/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corinnekrych/subscriptions","organizations_url":"https://api.github.com/users/corinnekrych/orgs","repos_url":"https://api.github.com/users/corinnekrych/repos","events_url":"https://api.github.com/users/corinnekrych/events{/privacy}","received_events_url":"https://api.github.com/users/corinnekrych/received_events","type":"User","site_admin":false},"html_url":"https://github.com/corinnekrych/almighty-core","description":null,"fork":true,"url":"https://api.github.com/repos/corinnekrych/almighty-core","forks_url":"https://api.github.com/repos/corinnekrych/almighty-core/forks","keys_url":"https://api.github.com/repos/corinnekrych/almighty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corinnekrych/almighty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corinnekrych/almighty-core/teams","hooks_url":"https://api.github.com/repos/corinnekrych/almighty-core/hooks","issue_events_url":"https://api.github.com/repos/corinnekrych/almighty-core/issues/events{/number}","events_url":"https://api.github.com/repos/corinnekrych/almighty-core/events","assignees_url":"https://api.github.com/repos/corinnekrych/almighty-core/assignees{/user}","branches_url":"https://api.github.com/repos/corinnekrych/almighty-core/branches{/branch}","tags_url":"https://api.github.com/repos/corinnekrych/almighty-core/tags","blobs_url":"https://api.github.com/repos/corinnekrych/almighty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corinnekrych/almighty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corinnekrych/almighty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/corinnekrych/almighty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corinnekrych/almighty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/corinnekrych/almighty-core/languages","stargazers_url":"https://api.github.com/repos/corinnekrych/almighty-core/stargazers","contributors_url":"https://api.github.com/repos/corinnekrych/almighty-core/contributors","subscribers_url":"https://api.github.com/repos/corinnekrych/almighty-core/subscribers","subscription_url":"https://api.github.com/repos/corinnekrych/almighty-core/subscription","commits_url":"https://api.github.com/repos/corinnekrych/almighty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/corinnekrych/almighty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/corinnekrych/almighty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/corinnekrych/almighty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/corinnekrych/almighty-core/contents/{+path}","compare_url":"https://api.github.com/repos/corinnekrych/almighty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corinnekrych/almighty-core/merges","archive_url":"https://api.github.com/repos/corinnekrych/almighty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corinnekrych/almighty-core/downloads","issues_url":"https://api.github.com/repos/corinnekrych/almighty-core/issues{/number}","pulls_url":"https://api.github.com/repos/corinnekrych/almighty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/corinnekrych/almighty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/corinnekrych/almighty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corinnekrych/almighty-core/labels{/name}","releases_url":"https://api.github.com/repos/corinnekrych/almighty-core/releases{/id}","deployments_url":"https://api.github.com/repos/corinnekrych/almighty-core/deployments","created_at":"2017-06-06T12:21:18Z","updated_at":"2017-06-06T12:21:21Z","pushed_at":"2018-11-30T15:16:43Z","git_url":"git://github.com/corinnekrych/almighty-core.git","ssh_url":"git@github.com:corinnekrych/almighty-core.git","clone_url":"https://github.com/corinnekrych/almighty-core.git","svn_url":"https://github.com/corinnekrych/almighty-core","homepage":"http://devdoc.almighty.io/","size":9852,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fabric8-services:master","ref":"master","sha":"0999ce97b10ea89326d27290265dd0210e83012a","user":{"login":"fabric8-services","id":29751612,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzUxNjEy","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":54260706,"node_id":"MDEwOlJlcG9zaXRvcnk1NDI2MDcwNg==","name":"fabric8-wit","full_name":"fabric8-services/fabric8-wit","private":false,"owner":{"login":"fabric8-services","id":29751612,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzUxNjEy","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},"html_url":"https://github.com/fabric8-services/fabric8-wit","description":"wit stands for Work Item Tracker","fork":false,"url":"https://api.github.com/repos/fabric8-services/fabric8-wit","forks_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/forks","keys_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/teams","hooks_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/hooks","issue_events_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/events{/number}","events_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/events","assignees_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/assignees{/user}","branches_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/branches{/branch}","tags_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/tags","blobs_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/git/refs{/sha}","trees_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/statuses/{sha}","languages_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/languages","stargazers_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/stargazers","contributors_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/contributors","subscribers_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/subscribers","subscription_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/subscription","commits_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/commits{/sha}","git_commits_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/git/commits{/sha}","comments_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/comments{/number}","issue_comment_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/comments{/number}","contents_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/contents/{+path}","compare_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/merges","archive_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/downloads","issues_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues{/number}","pulls_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls{/number}","milestones_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/milestones{/number}","notifications_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/labels{/name}","releases_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/releases{/id}","deployments_url":"https://api.github.com/repos/fabric8-services/fabric8-wit/deployments","created_at":"2016-03-19T10:42:15Z","updated_at":"2018-11-29T15:05:29Z","pushed_at":"2018-11-30T15:16:45Z","git_url":"git://github.com/fabric8-services/fabric8-wit.git","ssh_url":"git@github.com:fabric8-services/fabric8-wit.git","clone_url":"https://github.com/fabric8-services/fabric8-wit.git","svn_url":"https://github.com/fabric8-services/fabric8-wit","homepage":"http://devdoc.almighty.io/","size":14182,"stargazers_count":39,"watchers_count":39,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"archived":false,"open_issues_count":209,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":84,"open_issues":209,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358"},"html":{"href":"https://github.com/fabric8-services/fabric8-wit/pull/2358"},"issue":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/2358"},"comments":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/issues/2358/comments"},"review_comments":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358/comments"},"review_comment":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/pulls/2358/commits"},"statuses":{"href":"https://api.github.com/repos/fabric8-services/fabric8-wit/statuses/268a4fa3f0b1c93b6d33a76f07b0d3b9933425a6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jarifibrahim"}}