Hi fellow no-coders,
I’m trying to improve security AND performances on a SaaS App (B2B) whilst avoiding the sub-app path.
Here is the idea I would like to investigate further with a little help from you:
Context:
- Say User A belongs to Company A and User B to Company B (easy so far)
- Say the purpose of this App is for Companies to manage their assets with an obvious Data Type “Assets” but, for security reasons (Company A must not see Company B’s assets) and performances (the number of things is potentially very large for each company so with hundreds of companies using this App that will make searches and other DB actions very slow and resources-consuming), I would like to have separate Tables for each company
What I would like to do:
Create a Data type (table) “Company_X_Assets” for each Company. So we would have Company_A_Assets and Company_B_Assets in my exemple
Question: For any of my objects in the editor, when selecting the “Type of content” (> Data Type / Table), is there any way to set it dynamically based on the user profile / account ? As far as I can see, you can only choose from the list of Data types once and for all with no condition… Is there any sort of workaround to this?
You would need a data type ‘company’ and another ‘assets’. Then you should have a single thing ‘company’ as a field in the ‘asset’ data. This means every asset is linked to just one company. Then in the data type ‘company’ you have a list of ‘users’ so a company can have many users but an asset only has one company.
Then the type of content can be asset only belonging to the current user company.
Hope this makes sense.
EDIT
Apologies, I didn’t really answer your question about creating a new type for each company. You can setup workflows to do this but in the long run it won’t be viable. As you get more companies, the app would have to search just as much as it would with the above mentioned solution.
In reply to your other question, you can setup type of content to match a users company. So the data type would be asset and the source would be current user > company > asset
Normally though, you would set the data type on a page to just ‘company’ and then when you send data to that page it would just be the ‘current asset’. The search for the current users companies asset would be done in a repeating group on another page.
Hi Craig,
Thank you for your reply.
This is actually exactly how it is being handled for now…and maybe this is the only / best way to do it 
However, this doesn’t help for performances (the Assets table will have a very large number of records / things to search through) and, although this does address the security issue, some (large) customers insist on having separate tables as a pre-requisite / best-practice / internal policy to avoid any risk of seeing their data exposed to others… that’s why I am investigating this alternative
1 Like
As far as I know, from a workflow it’s not possible to create a new thing from an input field, its a static workflow input. If you can make an API call to create a new type then this may work, see options for making a new type on the API page Data API - Bubble Docs
PS - Edited my other comment to answer your question with regards to ‘type of content’
1 Like