{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/27241338","id":27241338,"diff_hunk":"@@ -27,18 +57,76 @@ func ValidateUserName(name string, prefix bool) (bool, string) {\n func ValidateUser(user *api.User) errs.ValidationErrorList {\n \tallErrs := errs.ValidationErrorList{}\n \tallErrs = append(allErrs, kvalidation.ValidateObjectMeta(&user.ObjectMeta, false, ValidateUserName).Prefix(\"metadata\")...)\n+\tfor index, identity := range user.Identities {\n+\t\tif ok, msg := ValidateIdentityName(identity, false); !ok {\n+\t\t\tallErrs = append(allErrs, errs.NewFieldInvalid(fmt.Sprintf(\"identities[%d]\", index), identity, msg))\n+\t\t}\n+\t}\n+\treturn allErrs\n+}\n+\n+func ValidateUserUpdate(user *api.User, old *api.User) errs.ValidationErrorList {\n+\tallErrs := errs.ValidationErrorList{}\n+\tallErrs = append(allErrs, kvalidation.ValidateObjectMetaUpdate(&old.ObjectMeta, &user.ObjectMeta).Prefix(\"metadata\")...)\n \treturn allErrs\n }\n \n func ValidateIdentity(identity *api.Identity) errs.ValidationErrorList {\n \tallErrs := errs.ValidationErrorList{}\n+\tallErrs = append(allErrs, kvalidation.ValidateObjectMeta(&identity.ObjectMeta, false, ValidateIdentityName).Prefix(\"metadata\")...)\n+\n+\tif len(identity.ProviderName) == 0 {\n+\t\tallErrs = append(allErrs, errs.NewFieldRequired(\"providerName\"))\n+\t}\n+\tif len(identity.ProviderUserName) == 0 {\n+\t\tallErrs = append(allErrs, errs.NewFieldRequired(\"providerUserName\"))\n+\t}\n+\tif len(identity.ProviderName) > 0 && len(identity.ProviderUserName) > 0 {\n+\t\texpectedIdentityName := identity.ProviderName + \":\" + identity.ProviderUserName\n+\t\tif identity.Name != expectedIdentityName {\n+\t\t\tallErrs = append(allErrs, errs.NewFieldInvalid(\"user.name\", identity.User.Name, fmt.Sprintf(\"must be %s\", expectedIdentityName)))\n+\t\t}\n+\t}\n+\n+\tif ok, msg := ValidateUserName(identity.User.Name, false); !ok {\n+\t\tallErrs = append(allErrs, errs.NewFieldInvalid(\"user.name\", identity.User.Name, msg))\n+\t}\n+\tif len(identity.User.Name) == 0 && len(identity.User.UID) != 0 {\n+\t\tallErrs = append(allErrs, errs.NewFieldInvalid(\"user.uid\", identity.User.UID, \"may not be set if user.name is empty\"))","path":"pkg/user/api/validation/validation.go","position":97,"original_position":97,"commit_id":"afb9cc62218b0111b5d45bc75ff538431a9275d5","original_commit_id":"14bda700b2d187e61f271cbb3761f0b2dd66287a","user":{"login":"deads2k","id":8225098,"avatar_url":"https://avatars.githubusercontent.com/u/8225098?v=3","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false},"body":"Isn't the reverse also true?  You set one you must set both?","created_at":"2015-03-26T18:24:01Z","updated_at":"2015-03-26T18:24:01Z","html_url":"https://github.com/openshift/origin/pull/1450#discussion_r27241338","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/1450","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/27241338"},"html":{"href":"https://github.com/openshift/origin/pull/1450#discussion_r27241338"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/1450"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/1450","id":31919034,"html_url":"https://github.com/openshift/origin/pull/1450","diff_url":"https://github.com/openshift/origin/pull/1450.diff","patch_url":"https://github.com/openshift/origin/pull/1450.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/1450","number":1450,"state":"open","locked":false,"title":"WIP - Split identity and user objects","user":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"body":"@deads2k still working on fixing integration tests, but the rest is ready to start looking at\r\n\r\n- [x] Create identity registry\r\n- [x] Refactor useridentitymapping registry to be a virtual registry building on user and identity registries\r\n- [x] Add full client support for identity, users, useridentitymappings (clients, describe, print)\r\n- [x] unit tests for user provisioning and useridentitymapping registry\r\n- [x] Fix integration tests\r\n- [x] Remove forced provider id from provisioner.go\r\n- [ ] Rewrite userclient integration test\r\n\r\nTODO in follow-ups:\r\n- [ ] Let identity providers indicate a preferred username (so the identity is google:12345, but you get yourname@gmail.com as your username if available)","created_at":"2015-03-25T12:54:11Z","updated_at":"2015-03-26T18:24:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9df0f64f42a9c46d47ef58afdc74fa311dfb140","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/1450/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/1450/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/1450/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/afb9cc62218b0111b5d45bc75ff538431a9275d5","head":{"label":"liggitt:split_identity","ref":"split_identity","sha":"afb9cc62218b0111b5d45bc75ff538431a9275d5","user":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"repo":{"id":23198153,"name":"origin","full_name":"liggitt/origin","owner":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/liggitt/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/liggitt/origin","forks_url":"https://api.github.com/repos/liggitt/origin/forks","keys_url":"https://api.github.com/repos/liggitt/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liggitt/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liggitt/origin/teams","hooks_url":"https://api.github.com/repos/liggitt/origin/hooks","issue_events_url":"https://api.github.com/repos/liggitt/origin/issues/events{/number}","events_url":"https://api.github.com/repos/liggitt/origin/events","assignees_url":"https://api.github.com/repos/liggitt/origin/assignees{/user}","branches_url":"https://api.github.com/repos/liggitt/origin/branches{/branch}","tags_url":"https://api.github.com/repos/liggitt/origin/tags","blobs_url":"https://api.github.com/repos/liggitt/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liggitt/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liggitt/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/liggitt/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liggitt/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/liggitt/origin/languages","stargazers_url":"https://api.github.com/repos/liggitt/origin/stargazers","contributors_url":"https://api.github.com/repos/liggitt/origin/contributors","subscribers_url":"https://api.github.com/repos/liggitt/origin/subscribers","subscription_url":"https://api.github.com/repos/liggitt/origin/subscription","commits_url":"https://api.github.com/repos/liggitt/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/liggitt/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/liggitt/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/liggitt/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/liggitt/origin/contents/{+path}","compare_url":"https://api.github.com/repos/liggitt/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liggitt/origin/merges","archive_url":"https://api.github.com/repos/liggitt/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liggitt/origin/downloads","issues_url":"https://api.github.com/repos/liggitt/origin/issues{/number}","pulls_url":"https://api.github.com/repos/liggitt/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/liggitt/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/liggitt/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liggitt/origin/labels{/name}","releases_url":"https://api.github.com/repos/liggitt/origin/releases{/id}","created_at":"2014-08-21T18:23:05Z","updated_at":"2015-03-26T14:34:50Z","pushed_at":"2015-03-26T18:11:59Z","git_url":"git://github.com/liggitt/origin.git","ssh_url":"git@github.com:liggitt/origin.git","clone_url":"https://github.com/liggitt/origin.git","svn_url":"https://github.com/liggitt/origin","homepage":"https://openshift.github.io","size":57650,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"2e784ee40c75ecbd07ef15fd83531a798706c287","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-03-26T17:58:13Z","pushed_at":"2015-03-26T18:12:00Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":83945,"stargazers_count":327,"watchers_count":327,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":174,"mirror_url":null,"open_issues_count":149,"forks":174,"open_issues":149,"watchers":327,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/1450"},"html":{"href":"https://github.com/openshift/origin/pull/1450"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/1450"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/1450/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/1450/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/1450/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/afb9cc62218b0111b5d45bc75ff538431a9275d5"}}}}