Multi Tenant

1. How to install

This step is obvious. It’s exactly the same in every plugin. To install a plugin you should perform the following steps:

1. In the admin panel, go to Plugins-> Local Plugins and Upload the plugin by pressing the Upload button in the top right corner.
2. Restart your application (or click Reload list of plugins button).
3. Scroll down through the list of plugins to find the newly uploaded plugin.
4. Click on the Install link to install the plugin.
5. The plugin is displayed in the Plugins windows (Plugins → Local Plugins).

2. How to configure the Multi-Tenant plugin

First of all, after an installation of the plugin, we will need to enable proper permissions in the Configuration -> Permissions page. Scroll down and find the permissions related to the Multi-Tenant plugin. 

It should be enabled only for the Administrator customer group.

After you save the settings, you will be able to access the Tenants list and the Configuration page.

Open the configuration page from the Extensions sidebar menu by pressing the Configure button.

On the Configuration page, we will need to specify three fields:

URL Redirection for the inactive store - when your tenant is not active and the customer will try to access it, GrandNode will redirect the customer to the URL that you provide here. It can be your main store or landing page, anything you want.

Default connection string - is a default connection string, you will be able to modify the {dbname} directly on every new tenant.

Default super admin (email) - email address of super admin, every tenant will have a super admin account. You can log in to the super admin account via the tenant configuration page by pressing the Login as a super admin button.

Now it's time to create our first tenant.

Then jump into the Tenant List and press the Add new button.

The creation process is straightforward. Everything comes to filling the necessary fields in the creation form. 

Name - Name of the tenant
Folder name - Name of the tenant folder, it's used to keep the generated thumbs for example. You will find it in the wwwroot folder.
URL - Url of the tenant
MongoDB Connection String - Connection string used to create a database
Main tenant record - You should set this if you are creating the main tenant, if you want to add a new domain to an existing tenant, you should leave it turned off.
Is Active - Is the tenant active or not
Install database - Check if you want to install GrandNode on the new database
Install sample data - Check if you want to provide the tenant to your customer with sample data
Super admin email - Email of the super admin user
Admin email - Store owner email address
Admin password - Store owner password
Valid to (optional) - if you offer a SaaS eCommerce platform with monthly or yearly fees, you should save there a subscription end date.
By default, to provide the highest security, the tenant has some limits, which can be easily modified and customized with source code:
- Scheduled Tasks
- Plugins management
- System information
- Customer Reminders
- Auction system
- External Authorization is not supported
- Push notifications are not supported
- Tenants don't have the possibility to upload their own pictures via elFinder.

Important information: tenants have only one scheduled task supported at the moment, it's the "Send emails" task and it's configurable directly from the main store. If you want to use other tasks, your developer has to develop them. Every tenant has access to the maintenance tools like clearing requests, logs.

Also please note that if you use multiple domains on a single tenant, emails will be sent from the main tenant email address.

3. Obligatory appsettings.json values

First of all, you have to set "IgnoreDbVersionCheckMiddleware" to true.

4. Recommended appsettings.json values

For security reasons, you should disable the plugin upload. You can do it by setting "DisableUploadExtensions" to true.

Then "IgnoreInstallUrlMiddleware" to true.