23
Views
4
Comments
Multi-tenants share forms
Application Type
Mobile, Reactive

Hi all.

I have a multi-tenanted reactive app with several tenants.

What I want to do, is enable each of the tenants, to use various forms to populate data and then have outsytems convert those forms into a PDF letter.

The bit I'm struggling with is, I need to be able to give the each of the tenants access to some of the forms, and share the forms across the tenants.

So for example

Tenant_One has access to
Form_1
Form_2
Form_3

Tenant_Two has access to 
Form_2
Form_3
Form_5

Tenant_Three has access to 
Form _4
Form_5
Form_6

A change to Form_2 should reflect immediately in both Tenant_one and Tenant_Two, so they'd have to share the entity and not have duplicates. 

It's possible that the allocation of forms to tenants could change frequently and so I'd need a way to enable access for Tenant_Three to Form_1, for example.

What is the best way to structure this, please?

Thank you very much
Leigh

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

You can evaluate the current tenant_Id in the OnInitialize event of a screen, and raise a User Exception that explains to the user that he or she has no access to that form.

To avoid you need to make changes frequently to your app, you could create a table and a backoffice screen to maintain which screens are allowed by which tenant, and query to determine if the user's current tenant is allowed to see the screen.

Regards,

Daniel

2021-11-22 00-14-28
Leigh Rogers

Thank you Daniel.
That is the sort of principle I expected, but how do I go about doing that on a practical level?

For example, in the not too distant future, there could be as many as 100 forms to share across the tenants.

How do I build the permissions for tenants without having to build a physical table with the tenants as rows and the forms as columns? This would require me to add a new column every time there is a new form. There must be a better way.. JSON list? 

How do I create 100 forms that do not use 100 application objects, and without having 100 IF rules on a single page? Other solutions have the ability to create the form in a 'form builder' and display the forms in a display_form page, dependent on an input parameter. Is similar possible in outsystems?


Thank you


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

Not sure what your thought process is, but with a backoffice screen and 1 entity you can implement this. So regardless of how many tentants you have this solution costs you 2 AO's.

Obviously, every screen you create is another AO. If your goal is to have less AO comsuptions, than consider to group all forms for 1 tenant in a form that uses a list on the entity with the form/tenant relation. Then show blocks conditionally in the form based on the aggregate output.

There is no shortcut to create forms and not consuming AO's unless you add some extra logic to your screen.

2021-11-22 00-14-28
Leigh Rogers

Thank you for the prompt reply Daniel.

Thinking structure like this...

1 - Form_Viewer_Page

This will have potentially 100 forms, each in a different container.

Input parameter called Mode.
Input parameter called FormID.

If Mode=Select, then list list forms available for tenantID for them to select

If Mode=View, then display the container with FormID


2 - Back_End_Form_Permissions

How do I best structure this?

A table containing a list of forms, and some associated metadata.

Perhaps a Site_Property containing a JSON list of allowed forms?

Select a site from drop down list, then the list of allowed ones appear on the left, and not yet allowed appear on the right? Option to add/remove from the list.

Is that best?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.