Hi, I think I found a mistake in the Multitenancy documentation.
https://docs.jmix.io/jmix/multitenancy/index.html
It specifies adding the following to the user-detail-view.xml:
<comboBox id="tenantField" property="tenant" readOnly="true"/>
I think it should be specified as:
<comboBox id="tenantField" property="tenant"/>
If the field is always read only, then the admin can never create a tenant user. I think it is necessary to leave it editable by default and allow the UserDetailView
class to protect it when necessary, as specified in the docs:
@Subscribe
public void onBeforeShow(final BeforeShowEvent event) {
String currentTenantId = tenantProvider.getCurrentUserTenantId();
if (!currentTenantId.equals(TenantProvider.NO_TENANT)
&& Strings.isNullOrEmpty(tenantField.getValue())) {
tenantField.setReadOnly(true);
tenantField.setValue(currentTenantId);
}
}
Right?