mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 19:20:04 +00:00
added UserStore.hasUsers for efficient check whether there are none
Change-Id: Ifacc9c84bda961399b866e860757e8ebe0d78b71
This commit is contained in:
1 parent
a505e4c69e
commit
680f3a0441
3 files changed
+8
-1
No files matched your search
+5
@@ -318,6 +318,11 @@ public class UserStoreImpl implements UserStore {
|
||||
return new ArrayList<User>(users.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasUsers() {
|
||||
return !users.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserByName(String name) {
|
||||
final User result;
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.sap.sse.security.shared.UserManagementException;
|
||||
|
||||
public interface UserStore extends Named {
|
||||
Iterable<User> getUsers();
|
||||
|
||||
boolean hasUsers();
|
||||
|
||||
/**
|
||||
* The user with that {@link User#getName() name} or {@code null} if no such user exists
|
||||
|
||||
@@ -191,7 +191,7 @@ public class SecurityServiceImpl implements ReplicableSecurityService, ClearStat
|
||||
* is empty.
|
||||
*/
|
||||
private void initEmptyStore() {
|
||||
if (Util.isEmpty(store.getUsers())) {
|
||||
if (!store.hasUsers()) {
|
||||
try {
|
||||
logger.info("No users found, creating default user \"admin\" with password \"admin\"");
|
||||
createSimpleUser("admin", "nobody@sapsailing.com", "admin",
|
||||
|
||||
Reference in new issue
Block a user