Multitenancy add-on with FlowUI

Hi Jmix team
I tried to use the multitenancy add-on in my flowUI project but it seems to me it is not ready yet, not all relevant APIs are available and the documentation is only available for classic UI. When do you think this add-on is going to be released for FlowUI?

Hi
The Multitenancy FlowUI add-on is published and has the same functionality as in the Classic UI.
The FlowUI add-on has minimal differences compared to the Classic add-on, so you can use the existing documentation.

Can you answer a couple of clarifying questions?
What version of the Jmix Framework are you using?
Could you describe in more detail what API is missing?

Regards,
Dmitriy

Hi Dmitriy
I tried to use the Add-on but didn’t find the multitenancyUiSupport in userDetailView controller (equivalent to classic name UserEditor in user guide).

image

I tried to import multitenancyFlowUiSupport but it was not available to import. Can you provide me the correct path of this API to use?

I am using version 1.5.0
I have attached a test project if you needed.
TestFlow.zip (120.4 KB)

The correct path to the desired component is io.jmix.multitenancyflowui.MultitenancyFlowuiSupport.

In your test project, I was able to import this class:
image

Regards,
Dmitriy

Thank you Dimitriy, with that correct path I could also import the API. Can you please update the documentation with the API name for FlowUI as it is only on the classic UI.

I have more questions regarding the use of this add-on in the composite project,

  1. How can I use this add-on that will be available to use in all add-ons within the composite project?

According to the documentation we have to add the following codes to the user log screen but in Flow login screen, i don’t see any such field as a form is used.

@Autowired
private UrlRouting urlRouting;

private void login() {
    String username = usernameField.getValue();
<loginForm id="login"
                   rememberMeVisible="false"
                   forgotPasswordButtonVisible="false">
            <form title= "msg://loginForm.headerTitle"
                  username="msg://loginForm.username"
                  password="msg://loginForm.password"
                  rememberMe="msg://loginForm.rememberMe"
                  submit="msg://loginForm.submit"
                  forgotPassword="msg://loginForm.forgotPassword"/>
            <errorMessage title="msg://loginForm.errorTitle"
                          message="msg://loginForm.badCredentials"/>
        </loginForm>

What will be the changes to fit this in flowUI?

What is the correct path for UrlRouting in flowUI? This (import io.jmix.ui.navigation.UrlRouting;) is not recognized.

Hi Mortoza,
Thanks for waiting for a reply.

For Point 1:
You can use Jmix Studio setting to manage dependencies between projects.
image

This will enable the FlowUI Multitenancy add-on for all projects.

For Point 2::
Work on FlowUI Documentation is underway.
Our team is doing everything possible to speed up this process.

About username and login form:
In the login() method you can get username via getter event.getUsername().
Instead of UrlRouting bean, you can use Vaadin’s com.vaadin.flow.router.Location, which provides access to query parameters.

Such changes have occurred in the FlowUI API.
Now you have to use the io.jmix.multitenancyflowui.MultitenancyFlowuiSupport#getUsernameByLocation method.

For your convenience, I created and attached a small test project (176.4 KB).
Here you will find examples of correct usage.

Also, if you want to get more information about the FlowUI Multitenancy add-on, you can read the notes in the Jmix framework issue.

I hope my answer will help you.

Regards,
Dmitriy

Hi Dmitriy
Thanks for the supporting info and test project. I have updated my project accordingly but couldn’t log in. Then I tried your project, creating a tenant called “tenant1” and a user called “test1” with the password “test1”. But unfortunately, it also didn’t work. I tried both “tenant1|test3” and “test3” as a user ID to log in but it failed with a bad credential message.

Thanks for letting me know how you logged in i.e. did you use “test3” as user ID or “tenant1|test3” as user ID. I would expect “test3” as the user ID without a prefix of the tenant ID. However, none of those options worked with your sample app. Looking forward for your response.

Hi Mortoza!
In the comments of the Jmix Framework issue (see my last reply), I described the possibility of logging in without a tenant prefix. In this case, you need to set the URL query parameter tenantId by yourself.

I have a guess about the inability to login, did you assign the flowui-minimal role to the newly created users? This role is required for login.

Regards,
Dmitriy

Hi Dmitriy
I noticed that your sample app is using Jmix 2.09999 version, but my project is based on Jmix 1.5.0, is there anything that may cause a failure of login in such a case?

Basic login - multitenancy:
When I tested my application, I already had assigned the user with flowui-minimal role but it’s still not working, though your sample app now works with that role. However, the main difference between your sample app and my web app is the fact that my one is a Composite flowUi project but your sample app is only a single project. Have you tested the multitenancy add-on for composite projects yet? If so, thanks for sharing.

Login without tenants name:
I followed all of your codes and instructions and hope it will work using of login id without a tenant prefix. If you mean your sample will not tackle it, please guide me to where I can get more info about this. It will be very helpful if you could add necessary adjustments to your sample app for the composite + multitenancy add-on which will be beneficial to all.

@d.kremnev, any updates?

I’m sorry to revive this topic, but there is still no solution in flowui. It’s impossible for me to login with admin, I always look for the tenantId parameter in the URL and this is not correct.
image
image

java.lang.IllegalStateException: Invalid query parameter with name tenantId
	at io.jmix.multitenancyflowui.impl.MultitenancyUiSupportImpl.getUsernameByLocation(MultitenancyUiSupportImpl.java:76)
	at com.trezetech.ezzy.view.login.LoginView.onLogin(LoginView.java:100)
	at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:233)
	at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:475)

It is my understanding that being the administrator he is not associated with any tenant, but apparently he does try to place it within a tenant.

If this is correct, then how should it be implemented, since the documentation is not adjusted to reality.

For the time being I rule out the use of flow for my current projects. I really wanted to use it.

Regards,

Nelson F.

Hi!

What version of the framework are you using?
This appears to be a known issue that has been resolved in the current release.

Another topic: IllegalStateException: Invalid query parameter with name tenantId

Regards,
Dmitriy

Hi @d.kremnev, I’m using v2.0.2.

This fix is applies to the 2.0.3 version and later.

When is this version released, from my ide I can only see 2.0.2.

image

I apologize for misleading you.
I meant version 2.1.0.
It’ll be released any day now.