• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi-User (instance) Project.

#1
Hi All,
 
Does anyone have suggestions on best practices to allow multiple users to access specific databases, from the same instance of the application using CI4?
 
I've developed a customer application using CI4, however other companies are interested in using the application. I do NOT want to copy the application for each company (with their own config) as this will cause major headaches with any sort of change management and maintenance.
 
My first thought was to replicate the database tables, prepend the table name with a unique identifier and tie the identifier to the customer "profile" and make this available via some variable or other. However I do not think this is robust enough or secure enough.
 
I'm now thinking of creating a separate database instances for each customer, and somehow identifying the correct database instance in CI4 (app->config->database.php), when the user logs in.
 
Any tips, suggestion or nudges in the right direction will be very much appreciated?
Reply

#2
I would definitely create separate databases per company. You can have a global database to deal with the logins and user profiles. In the user profile you can set the database name this user has access to. Then you can connect to this second DB with that database name.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
Reply

#3
(12-19-2020, 04:14 AM)68thorby68 Wrote: Hi All,
 
I've developed a customer application using CI4, however other companies are interested in using the application. I do NOT want to copy the application for each company (with their own config) as this will cause major headaches with any sort of change management and maintenance.

Selling three different systems as SaaS (all developed in CI3 and CI4) and hosting them on Amazon I’d say - think scalable from the beginning! Isolate the systems using different host names and hosting environments.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.