// USERS
public void onNewUser(Map<String, String> fields) {
- getContainer().getComponentByType(NewUserNotifier.class).onNewUser(NewUserHandler.Context.builder()
- .setLogin(fields.get("login"))
- .setName(fields.get("name"))
- .setEmail(fields.get("email"))
- .build());
+ NewUserNotifier notifier = getContainer().getComponentByType(NewUserNotifier.class);
+ // notifier is null when creating the administrator in the migration script 011.
+ if (notifier != null) {
+ notifier.onNewUser(NewUserHandler.Context.builder()
+ .setLogin(fields.get("login"))
+ .setName(fields.get("name"))
+ .setEmail(fields.get("email"))
+ .build());
+ }
}
}
private
def on_create
- facade = Java::OrgSonarServerUi::JRubyFacade.getInstance()
- if facade
- # the facade is null when creating the administration in migration 011
- facade.onNewUser({'login' => self.login, 'name' => self.name, 'email' => self.email})
- end
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().onNewUser({'login' => self.login, 'name' => self.name, 'email' => self.email})
end
end