File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
main/java/org/gridsuite/useradmin/server/service
test/java/org/gridsuite/useradmin/server Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public void delete(UUID id, String userId) {
65
65
}
66
66
67
67
public boolean subExists (String sub ) {
68
- Boolean isAllowed = (applicationProps .getAdmins ().isEmpty () && userAdminRepository .count () == 0 ) || !userAdminRepository .findAllBySub (sub ).isEmpty ();
68
+ Boolean isAllowed = (applicationProps .getAdmins ().isEmpty () && userAdminRepository .count () == 0 ) || applicationProps . getAdmins (). contains ( sub ) || !userAdminRepository .findAllBySub (sub ).isEmpty ();
69
69
connectionsService .recordConnectionAttempt (sub , isAllowed );
70
70
return isAllowed .booleanValue ();
71
71
}
Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ public void testUserAdmin() throws Exception {
83
83
84
84
assertEquals (0 , userEntities .size ());
85
85
86
+ mockMvc .perform (head ("/" + UserAdminApi .API_VERSION + "/users/{sub}" , ADMIN_USER ))
87
+ .andExpect (status ().isOk ())
88
+ .andReturn ();
89
+
86
90
mockMvc .perform (post ("/" + UserAdminApi .API_VERSION + "/users/{sub}" , USER_SUB )
87
91
.header ("userId" , ADMIN_USER )
88
92
)
@@ -109,7 +113,7 @@ public void testUserAdmin() throws Exception {
109
113
mockMvc .perform (head ("/" + UserAdminApi .API_VERSION + "/users/{sub}" , "UNKNOWN" ))
110
114
.andExpect (status ().isNoContent ())
111
115
.andReturn ();
112
- assertEquals (2 , connectionRepository .findAll ().size ());
116
+ assertEquals (3 , connectionRepository .findAll ().size ());
113
117
assertTrue (connectionRepository .findBySub (USER_SUB ).get (0 ).getConnectionAccepted ());
114
118
assertFalse (connectionRepository .findBySub ("UNKNOWN" ).get (0 ).getConnectionAccepted ());
115
119
LocalDateTime firstConnectionDate = connectionRepository .findBySub (USER_SUB ).get (0 ).getFirstConnexionDate ();
You can’t perform that action at this time.
0 commit comments