Im starting a new project on jmix 2 (finally )
I’m enabling the multitenancy addon. The documentation states a number of things to add to the controller and descriptor for UserDetailView.
For most of the methods there is on overlap between the documentation and the code i have in my newly 2.3 application.
Eg. in the onInit method both declare
timeZoneField.setItems(List.of(TimeZone.getAvailableIDs()));
Except for the OnBeforeSave method where the code sets a password encoder and the multitenancy documentation doesnt mention this.
Im gonna assume it should be there and the documentation is incorrect
@Subscribe
protected void onBeforeSave(final BeforeSaveEvent event) {
if (entityStates.isNew(getEditedEntity())) {
getEditedEntity().setPassword(passwordEncoder.encode(passwordField.getValue()));
}
String currentTenantId = tenantProvider.getCurrentUserTenantId();
if (!currentTenantId.equals(TenantProvider.NO_TENANT)
&& Strings.isNullOrEmpty(tenantField.getValue())) {
tenantField.setReadOnly(true);
tenantField.setValue(currentTenantId);
}
}