{"action":"created","comment":{"url":"https://api.github.com/repos/codenvy/codenvy/pulls/comments/80723206","pull_request_review_id":1758836,"id":80723206,"diff_hunk":"@@ -68,26 +78,53 @@\n     @Named(\"codenvy.admin.email\")\n     private String email;\n \n+    @Inject\n+    @Named(\"sys.auth.handler.default\")\n+    private String authHandler;\n+\n     @PostConstruct\n     public void create() throws ServerException {\n-        User adminUser;\n+        boolean shouldCreateAdmin = true;\n+        if (LdapAuthenticationHandler.TYPE.equals(authHandler)) {\n+            eventService.subscribe(this);\n+            shouldCreateAdmin = false;\n+        }\n         try {\n-            adminUser = userManager.getById(name);\n+            User adminUser = userManager.getByName(name);\n+            grantSystemPermissions(adminUser.getId());\n         } catch (NotFoundException ex) {\n-            try {\n-                adminUser =  userManager.create(new UserImpl(name, email, name, password, emptyList()), false);\n-                LOG.info(\"Admin user '\" + name + \"' successfully created\");\n-            } catch (ConflictException cfEx) {\n-                LOG.warn(\"Admin user creation failed\", cfEx.getLocalizedMessage());\n-                return;\n+            if (shouldCreateAdmin) {\n+                try {\n+                    User adminUser = userManager.create(new UserImpl(name, email, name, password, emptyList()), false);\n+                    grantSystemPermissions(adminUser.getId());","path":"wsmaster/codenvy-hosted-api-admin/src/main/java/com/codenvy/api/user/server/AdminUserCreator.java","position":89,"original_position":89,"commit_id":"dca61bd4c4bf2291eb171ef1af961662f7c1bcc3","original_commit_id":"dca61bd4c4bf2291eb171ef1af961662f7c1bcc3","user":{"login":"sleshchenko","id":5887312,"avatar_url":"https://avatars.githubusercontent.com/u/5887312?v=3","gravatar_id":"","url":"https://api.github.com/users/sleshchenko","html_url":"https://github.com/sleshchenko","followers_url":"https://api.github.com/users/sleshchenko/followers","following_url":"https://api.github.com/users/sleshchenko/following{/other_user}","gists_url":"https://api.github.com/users/sleshchenko/gists{/gist_id}","starred_url":"https://api.github.com/users/sleshchenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sleshchenko/subscriptions","organizations_url":"https://api.github.com/users/sleshchenko/orgs","repos_url":"https://api.github.com/users/sleshchenko/repos","events_url":"https://api.github.com/users/sleshchenko/events{/privacy}","received_events_url":"https://api.github.com/users/sleshchenko/received_events","type":"User","site_admin":false},"body":"Will be user granted twice? Here and on event?","created_at":"2016-09-27T15:38:16Z","updated_at":"2016-09-27T15:43:38Z","html_url":"https://github.com/codenvy/codenvy/pull/849#discussion_r80723206","pull_request_url":"https://api.github.com/repos/codenvy/codenvy/pulls/849","_links":{"self":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/comments/80723206"},"html":{"href":"https://github.com/codenvy/codenvy/pull/849#discussion_r80723206"},"pull_request":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/849"}}},"pull_request":{"url":"https://api.github.com/repos/codenvy/codenvy/pulls/849","id":86919316,"html_url":"https://github.com/codenvy/codenvy/pull/849","diff_url":"https://github.com/codenvy/codenvy/pull/849.diff","patch_url":"https://github.com/codenvy/codenvy/pull/849.patch","issue_url":"https://api.github.com/repos/codenvy/codenvy/issues/849","number":849,"state":"open","locked":false,"title":"CODENVY-398; Make it possible to perform integration with customers ldap","user":{"login":"mshaposhnik","id":1651062,"avatar_url":"https://avatars.githubusercontent.com/u/1651062?v=3","gravatar_id":"","url":"https://api.github.com/users/mshaposhnik","html_url":"https://github.com/mshaposhnik","followers_url":"https://api.github.com/users/mshaposhnik/followers","following_url":"https://api.github.com/users/mshaposhnik/following{/other_user}","gists_url":"https://api.github.com/users/mshaposhnik/gists{/gist_id}","starred_url":"https://api.github.com/users/mshaposhnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshaposhnik/subscriptions","organizations_url":"https://api.github.com/users/mshaposhnik/orgs","repos_url":"https://api.github.com/users/mshaposhnik/repos","events_url":"https://api.github.com/users/mshaposhnik/events{/privacy}","received_events_url":"https://api.github.com/users/mshaposhnik/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\n -  Adds possibility to migrate data from 3-rd party LDAP server;\r\n -  Adds possibility to authenticate users via 3-rd party LDAP server;\r\n\r\n### What issues does this PR fix or reference?\r\n#CODENVY-398\r\n\r\n### Tests written?\r\nYes","created_at":"2016-09-27T12:26:28Z","updated_at":"2016-09-27T15:43:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89550854e5ec6aac464206295f01c1c64596cda0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codenvy/codenvy/pulls/849/commits","review_comments_url":"https://api.github.com/repos/codenvy/codenvy/pulls/849/comments","review_comment_url":"https://api.github.com/repos/codenvy/codenvy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codenvy/codenvy/issues/849/comments","statuses_url":"https://api.github.com/repos/codenvy/codenvy/statuses/dca61bd4c4bf2291eb171ef1af961662f7c1bcc3","head":{"label":"codenvy:ldap","ref":"ldap","sha":"dca61bd4c4bf2291eb171ef1af961662f7c1bcc3","user":{"login":"codenvy","id":2736247,"avatar_url":"https://avatars.githubusercontent.com/u/2736247?v=3","gravatar_id":"","url":"https://api.github.com/users/codenvy","html_url":"https://github.com/codenvy","followers_url":"https://api.github.com/users/codenvy/followers","following_url":"https://api.github.com/users/codenvy/following{/other_user}","gists_url":"https://api.github.com/users/codenvy/gists{/gist_id}","starred_url":"https://api.github.com/users/codenvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codenvy/subscriptions","organizations_url":"https://api.github.com/users/codenvy/orgs","repos_url":"https://api.github.com/users/codenvy/repos","events_url":"https://api.github.com/users/codenvy/events{/privacy}","received_events_url":"https://api.github.com/users/codenvy/received_events","type":"Organization","site_admin":false},"repo":{"id":54102761,"name":"codenvy","full_name":"codenvy/codenvy","owner":{"login":"codenvy","id":2736247,"avatar_url":"https://avatars.githubusercontent.com/u/2736247?v=3","gravatar_id":"","url":"https://api.github.com/users/codenvy","html_url":"https://github.com/codenvy","followers_url":"https://api.github.com/users/codenvy/followers","following_url":"https://api.github.com/users/codenvy/following{/other_user}","gists_url":"https://api.github.com/users/codenvy/gists{/gist_id}","starred_url":"https://api.github.com/users/codenvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codenvy/subscriptions","organizations_url":"https://api.github.com/users/codenvy/orgs","repos_url":"https://api.github.com/users/codenvy/repos","events_url":"https://api.github.com/users/codenvy/events{/privacy}","received_events_url":"https://api.github.com/users/codenvy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codenvy/codenvy","description":"Codenvy","fork":false,"url":"https://api.github.com/repos/codenvy/codenvy","forks_url":"https://api.github.com/repos/codenvy/codenvy/forks","keys_url":"https://api.github.com/repos/codenvy/codenvy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codenvy/codenvy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codenvy/codenvy/teams","hooks_url":"https://api.github.com/repos/codenvy/codenvy/hooks","issue_events_url":"https://api.github.com/repos/codenvy/codenvy/issues/events{/number}","events_url":"https://api.github.com/repos/codenvy/codenvy/events","assignees_url":"https://api.github.com/repos/codenvy/codenvy/assignees{/user}","branches_url":"https://api.github.com/repos/codenvy/codenvy/branches{/branch}","tags_url":"https://api.github.com/repos/codenvy/codenvy/tags","blobs_url":"https://api.github.com/repos/codenvy/codenvy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codenvy/codenvy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codenvy/codenvy/git/refs{/sha}","trees_url":"https://api.github.com/repos/codenvy/codenvy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codenvy/codenvy/statuses/{sha}","languages_url":"https://api.github.com/repos/codenvy/codenvy/languages","stargazers_url":"https://api.github.com/repos/codenvy/codenvy/stargazers","contributors_url":"https://api.github.com/repos/codenvy/codenvy/contributors","subscribers_url":"https://api.github.com/repos/codenvy/codenvy/subscribers","subscription_url":"https://api.github.com/repos/codenvy/codenvy/subscription","commits_url":"https://api.github.com/repos/codenvy/codenvy/commits{/sha}","git_commits_url":"https://api.github.com/repos/codenvy/codenvy/git/commits{/sha}","comments_url":"https://api.github.com/repos/codenvy/codenvy/comments{/number}","issue_comment_url":"https://api.github.com/repos/codenvy/codenvy/issues/comments{/number}","contents_url":"https://api.github.com/repos/codenvy/codenvy/contents/{+path}","compare_url":"https://api.github.com/repos/codenvy/codenvy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codenvy/codenvy/merges","archive_url":"https://api.github.com/repos/codenvy/codenvy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codenvy/codenvy/downloads","issues_url":"https://api.github.com/repos/codenvy/codenvy/issues{/number}","pulls_url":"https://api.github.com/repos/codenvy/codenvy/pulls{/number}","milestones_url":"https://api.github.com/repos/codenvy/codenvy/milestones{/number}","notifications_url":"https://api.github.com/repos/codenvy/codenvy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codenvy/codenvy/labels{/name}","releases_url":"https://api.github.com/repos/codenvy/codenvy/releases{/id}","deployments_url":"https://api.github.com/repos/codenvy/codenvy/deployments","created_at":"2016-03-17T08:51:27Z","updated_at":"2016-09-15T20:20:20Z","pushed_at":"2016-09-27T15:27:18Z","git_url":"git://github.com/codenvy/codenvy.git","ssh_url":"git@github.com:codenvy/codenvy.git","clone_url":"https://github.com/codenvy/codenvy.git","svn_url":"https://github.com/codenvy/codenvy","homepage":null,"size":77529,"stargazers_count":28,"watchers_count":28,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":136,"forks":23,"open_issues":136,"watchers":28,"default_branch":"master"}},"base":{"label":"codenvy:master","ref":"master","sha":"cb1760ac90c3e6ad463457739a17e39a463ad9b3","user":{"login":"codenvy","id":2736247,"avatar_url":"https://avatars.githubusercontent.com/u/2736247?v=3","gravatar_id":"","url":"https://api.github.com/users/codenvy","html_url":"https://github.com/codenvy","followers_url":"https://api.github.com/users/codenvy/followers","following_url":"https://api.github.com/users/codenvy/following{/other_user}","gists_url":"https://api.github.com/users/codenvy/gists{/gist_id}","starred_url":"https://api.github.com/users/codenvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codenvy/subscriptions","organizations_url":"https://api.github.com/users/codenvy/orgs","repos_url":"https://api.github.com/users/codenvy/repos","events_url":"https://api.github.com/users/codenvy/events{/privacy}","received_events_url":"https://api.github.com/users/codenvy/received_events","type":"Organization","site_admin":false},"repo":{"id":54102761,"name":"codenvy","full_name":"codenvy/codenvy","owner":{"login":"codenvy","id":2736247,"avatar_url":"https://avatars.githubusercontent.com/u/2736247?v=3","gravatar_id":"","url":"https://api.github.com/users/codenvy","html_url":"https://github.com/codenvy","followers_url":"https://api.github.com/users/codenvy/followers","following_url":"https://api.github.com/users/codenvy/following{/other_user}","gists_url":"https://api.github.com/users/codenvy/gists{/gist_id}","starred_url":"https://api.github.com/users/codenvy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codenvy/subscriptions","organizations_url":"https://api.github.com/users/codenvy/orgs","repos_url":"https://api.github.com/users/codenvy/repos","events_url":"https://api.github.com/users/codenvy/events{/privacy}","received_events_url":"https://api.github.com/users/codenvy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codenvy/codenvy","description":"Codenvy","fork":false,"url":"https://api.github.com/repos/codenvy/codenvy","forks_url":"https://api.github.com/repos/codenvy/codenvy/forks","keys_url":"https://api.github.com/repos/codenvy/codenvy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codenvy/codenvy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codenvy/codenvy/teams","hooks_url":"https://api.github.com/repos/codenvy/codenvy/hooks","issue_events_url":"https://api.github.com/repos/codenvy/codenvy/issues/events{/number}","events_url":"https://api.github.com/repos/codenvy/codenvy/events","assignees_url":"https://api.github.com/repos/codenvy/codenvy/assignees{/user}","branches_url":"https://api.github.com/repos/codenvy/codenvy/branches{/branch}","tags_url":"https://api.github.com/repos/codenvy/codenvy/tags","blobs_url":"https://api.github.com/repos/codenvy/codenvy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codenvy/codenvy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codenvy/codenvy/git/refs{/sha}","trees_url":"https://api.github.com/repos/codenvy/codenvy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codenvy/codenvy/statuses/{sha}","languages_url":"https://api.github.com/repos/codenvy/codenvy/languages","stargazers_url":"https://api.github.com/repos/codenvy/codenvy/stargazers","contributors_url":"https://api.github.com/repos/codenvy/codenvy/contributors","subscribers_url":"https://api.github.com/repos/codenvy/codenvy/subscribers","subscription_url":"https://api.github.com/repos/codenvy/codenvy/subscription","commits_url":"https://api.github.com/repos/codenvy/codenvy/commits{/sha}","git_commits_url":"https://api.github.com/repos/codenvy/codenvy/git/commits{/sha}","comments_url":"https://api.github.com/repos/codenvy/codenvy/comments{/number}","issue_comment_url":"https://api.github.com/repos/codenvy/codenvy/issues/comments{/number}","contents_url":"https://api.github.com/repos/codenvy/codenvy/contents/{+path}","compare_url":"https://api.github.com/repos/codenvy/codenvy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codenvy/codenvy/merges","archive_url":"https://api.github.com/repos/codenvy/codenvy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codenvy/codenvy/downloads","issues_url":"https://api.github.com/repos/codenvy/codenvy/issues{/number}","pulls_url":"https://api.github.com/repos/codenvy/codenvy/pulls{/number}","milestones_url":"https://api.github.com/repos/codenvy/codenvy/milestones{/number}","notifications_url":"https://api.github.com/repos/codenvy/codenvy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codenvy/codenvy/labels{/name}","releases_url":"https://api.github.com/repos/codenvy/codenvy/releases{/id}","deployments_url":"https://api.github.com/repos/codenvy/codenvy/deployments","created_at":"2016-03-17T08:51:27Z","updated_at":"2016-09-15T20:20:20Z","pushed_at":"2016-09-27T15:27:18Z","git_url":"git://github.com/codenvy/codenvy.git","ssh_url":"git@github.com:codenvy/codenvy.git","clone_url":"https://github.com/codenvy/codenvy.git","svn_url":"https://github.com/codenvy/codenvy","homepage":null,"size":77529,"stargazers_count":28,"watchers_count":28,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":136,"forks":23,"open_issues":136,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/849"},"html":{"href":"https://github.com/codenvy/codenvy/pull/849"},"issue":{"href":"https://api.github.com/repos/codenvy/codenvy/issues/849"},"comments":{"href":"https://api.github.com/repos/codenvy/codenvy/issues/849/comments"},"review_comments":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/849/comments"},"review_comment":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codenvy/codenvy/pulls/849/commits"},"statuses":{"href":"https://api.github.com/repos/codenvy/codenvy/statuses/dca61bd4c4bf2291eb171ef1af961662f7c1bcc3"}}}}
{"actor":{"display_login":"sleshchenko"}}