{"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/102195803","pull_request_review_id":22943222,"id":102195803,"diff_hunk":"@@ -131,6 +143,174 @@ public void shouldOnlyReloadUsersOrRolesIfNeeded() throws Throwable\n         assertSetUsersAndRolesNTimes( true, true, 1, 1 );\n     }\n \n+    @Test\n+    public void shouldAssignAdminRoleToDefaultUser() throws Throwable\n+    {\n+        // Given\n+        InternalFlatFileRealm realm = internalTestRealmWithUsers( Collections.emptyList(), Collections.emptyList() );\n+\n+        // When\n+        realm.initialize();\n+        realm.start();\n+\n+        // Then\n+        assertThat( realm.getUsernamesForRole( PredefinedRoles.ADMIN ),\n+                contains( InternalFlatFileRealm.INITIAL_USER_NAME ) );\n+    }\n+\n+    @Test\n+    public void shouldAssignAdminRoleToSpecifiedUser() throws Throwable\n+    {\n+        // Given\n+        InternalFlatFileRealm realm = internalTestRealmWithUsers( Arrays.asList( \"neo4j\", \"morpheus\", \"trinity\" ),\n+                Collections.singletonList( \"morpheus\" ) );\n+\n+        // When\n+        realm.initialize();\n+        realm.start();\n+\n+        // Then\n+        assertThat( realm.getUsernamesForRole( PredefinedRoles.ADMIN ), contains( \"morpheus\" ) );\n+        assertThat( realm.getUsernamesForRole( PredefinedRoles.ADMIN ).size(), equalTo( 1 ) );\n+    }\n+\n+    @Test\n+    public void shouldAssignAdminRoleToOnlyUser() throws Throwable\n+    {\n+        // Given\n+        InternalFlatFileRealm realm =\n+                internalTestRealmWithUsers( Collections.singletonList( \"morpheus\" ), Collections.emptyList() );\n+\n+        // When\n+        realm.initialize();\n+        realm.start();\n+\n+        // Then\n+        assertThat( realm.getUsernamesForRole( PredefinedRoles.ADMIN ), contains( \"morpheus\" ) );\n+        assertThat( realm.getUsernamesForRole( PredefinedRoles.ADMIN ).size(), equalTo( 1 ) );\n+    }\n+\n+    @Test\n+    public void shouldNotAssignAdminToNonExistentUser() throws Throwable\n+    {\n+        // Given\n+        InternalFlatFileRealm realm = internalTestRealmWithUsers( Collections.singletonList( \"neo4j\" ),\n+                Collections.singletonList( \"morpheus\" ) );\n+\n+        // Expect\n+        exception.expect( InvalidArgumentsException.class );\n+        exception.expectMessage( \"No roles defined, and default admin user 'morpheus' does not exist. Please use `\" +\n+                SetDefaultAdminCommand.COMMAND_NAME + \"` to select a valid admin.\" );","path":"enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/InternalFlatFileRealmTest.java","position":112,"original_position":112,"commit_id":"53ca3fdf3943386579fd5f713bf32893dfd6a89e","original_commit_id":"53ca3fdf3943386579fd5f713bf32893dfd6a89e","user":{"login":"fickludd","id":3527193,"avatar_url":"https://avatars.githubusercontent.com/u/3527193?v=3","gravatar_id":"","url":"https://api.github.com/users/fickludd","html_url":"https://github.com/fickludd","followers_url":"https://api.github.com/users/fickludd/followers","following_url":"https://api.github.com/users/fickludd/following{/other_user}","gists_url":"https://api.github.com/users/fickludd/gists{/gist_id}","starred_url":"https://api.github.com/users/fickludd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fickludd/subscriptions","organizations_url":"https://api.github.com/users/fickludd/orgs","repos_url":"https://api.github.com/users/fickludd/repos","events_url":"https://api.github.com/users/fickludd/events{/privacy}","received_events_url":"https://api.github.com/users/fickludd/received_events","type":"User","site_admin":false},"body":"Now it says to use `set-default-admin`. Maybe we should also mention that this command lives in `neo4j-admin`?","created_at":"2017-02-21T12:25:50Z","updated_at":"2017-02-21T12:29:53Z","html_url":"https://github.com/neo4j/neo4j/pull/8858#discussion_r102195803","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/8858","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/102195803"},"html":{"href":"https://github.com/neo4j/neo4j/pull/8858#discussion_r102195803"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/8858"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/8858","id":107007888,"html_url":"https://github.com/neo4j/neo4j/pull/8858","diff_url":"https://github.com/neo4j/neo4j/pull/8858.diff","patch_url":"https://github.com/neo4j/neo4j/pull/8858.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/8858","number":8858,"state":"open","locked":false,"title":"Fixed failure during init resulting in no admin","user":{"login":"OliviaYtterbrink","id":979036,"avatar_url":"https://avatars.githubusercontent.com/u/979036?v=3","gravatar_id":"","url":"https://api.github.com/users/OliviaYtterbrink","html_url":"https://github.com/OliviaYtterbrink","followers_url":"https://api.github.com/users/OliviaYtterbrink/followers","following_url":"https://api.github.com/users/OliviaYtterbrink/following{/other_user}","gists_url":"https://api.github.com/users/OliviaYtterbrink/gists{/gist_id}","starred_url":"https://api.github.com/users/OliviaYtterbrink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliviaYtterbrink/subscriptions","organizations_url":"https://api.github.com/users/OliviaYtterbrink/orgs","repos_url":"https://api.github.com/users/OliviaYtterbrink/repos","events_url":"https://api.github.com/users/OliviaYtterbrink/events{/privacy}","received_events_url":"https://api.github.com/users/OliviaYtterbrink/received_events","type":"User","site_admin":false},"body":"When starting database first time default roles get created and a user is made admin.\r\nIf there is a failure due to multiple users existing and no default admin is specified\r\nsubsequent database start would not try to promote user to admin, resulting in\r\nthere being no admin.","created_at":"2017-02-20T13:41:37Z","updated_at":"2017-02-21T12:29:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"531cd40500d2b0674cfd733cdb826a3a5f6f2ccf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/8858/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/8858/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/8858/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/53ca3fdf3943386579fd5f713bf32893dfd6a89e","head":{"label":"OliviaYtterbrink:3.1-default-admin-command","ref":"3.1-default-admin-command","sha":"53ca3fdf3943386579fd5f713bf32893dfd6a89e","user":{"login":"OliviaYtterbrink","id":979036,"avatar_url":"https://avatars.githubusercontent.com/u/979036?v=3","gravatar_id":"","url":"https://api.github.com/users/OliviaYtterbrink","html_url":"https://github.com/OliviaYtterbrink","followers_url":"https://api.github.com/users/OliviaYtterbrink/followers","following_url":"https://api.github.com/users/OliviaYtterbrink/following{/other_user}","gists_url":"https://api.github.com/users/OliviaYtterbrink/gists{/gist_id}","starred_url":"https://api.github.com/users/OliviaYtterbrink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliviaYtterbrink/subscriptions","organizations_url":"https://api.github.com/users/OliviaYtterbrink/orgs","repos_url":"https://api.github.com/users/OliviaYtterbrink/repos","events_url":"https://api.github.com/users/OliviaYtterbrink/events{/privacy}","received_events_url":"https://api.github.com/users/OliviaYtterbrink/received_events","type":"User","site_admin":false},"repo":{"id":49431398,"name":"neo4j","full_name":"OliviaYtterbrink/neo4j","owner":{"login":"OliviaYtterbrink","id":979036,"avatar_url":"https://avatars.githubusercontent.com/u/979036?v=3","gravatar_id":"","url":"https://api.github.com/users/OliviaYtterbrink","html_url":"https://github.com/OliviaYtterbrink","followers_url":"https://api.github.com/users/OliviaYtterbrink/followers","following_url":"https://api.github.com/users/OliviaYtterbrink/following{/other_user}","gists_url":"https://api.github.com/users/OliviaYtterbrink/gists{/gist_id}","starred_url":"https://api.github.com/users/OliviaYtterbrink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliviaYtterbrink/subscriptions","organizations_url":"https://api.github.com/users/OliviaYtterbrink/orgs","repos_url":"https://api.github.com/users/OliviaYtterbrink/repos","events_url":"https://api.github.com/users/OliviaYtterbrink/events{/privacy}","received_events_url":"https://api.github.com/users/OliviaYtterbrink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OliviaYtterbrink/neo4j","description":"Graphs for Everyone","fork":true,"url":"https://api.github.com/repos/OliviaYtterbrink/neo4j","forks_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/forks","keys_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/teams","hooks_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/hooks","issue_events_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/events","assignees_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/tags","blobs_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/languages","stargazers_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/stargazers","contributors_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/contributors","subscribers_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/subscribers","subscription_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/subscription","commits_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/merges","archive_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/downloads","issues_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/OliviaYtterbrink/neo4j/deployments","created_at":"2016-01-11T14:26:12Z","updated_at":"2016-01-11T14:26:35Z","pushed_at":"2017-02-20T13:33:57Z","git_url":"git://github.com/OliviaYtterbrink/neo4j.git","ssh_url":"git@github.com:OliviaYtterbrink/neo4j.git","clone_url":"https://github.com/OliviaYtterbrink/neo4j.git","svn_url":"https://github.com/OliviaYtterbrink/neo4j","homepage":"http://neo4j.com","size":331379,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"3.2"}},"base":{"label":"neo4j:3.1","ref":"3.1","sha":"bf2784c20ec79513e2af0222847ef49e201985a6","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/neo4j/neo4j/deployments","created_at":"2012-11-12T08:46:15Z","updated_at":"2017-02-21T09:59:15Z","pushed_at":"2017-02-21T11:05:28Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.com","size":331849,"stargazers_count":3494,"watchers_count":3494,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1079,"mirror_url":null,"open_issues_count":407,"forks":1079,"open_issues":407,"watchers":3494,"default_branch":"3.2"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/8858"},"html":{"href":"https://github.com/neo4j/neo4j/pull/8858"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/8858"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/8858/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/8858/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/8858/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/53ca3fdf3943386579fd5f713bf32893dfd6a89e"}}}}
{"actor":{"display_login":"fickludd"}}