}
@Override
public void run() {
Filter filter = FilterUtils.makeFilter(UserDataManager.class, "(internal=true)");
UserDataManager userManager = (UserDataManager) utilsService.getService(filter);
if (!userManager.getUserList().isEmpty()) {
return;
}
try {
userManager.createUser("admin");
userManager.createUser("user");
} catch (UserExistsException e) {
LOGGER.error("this should not happen... I just checked whether the userbase is empty", e);
return;
}
try {
userManager.setUserCredentials("admin", "password", "password");
userManager.setUserCredentials("user", "password", "password");
userManager.createPermissionSet("ROLE_ROOT", new RootPermission());
userManager.addPermissionSetToUser("admin", "ROLE_ROOT");
userManager.addPermissionSetToUser("user", "INDEX");
} catch (PermissionSetAlreadyExistsException e) {
LOGGER.error("this should not happen... I just checked whether the userbase is empty", e);
}
}