Module Installation
By following the steps below, you will be able to convert your non-multitenant Broadleaf site to one that supports switching
themes. At the time of writing, these instructions were based on the Broadleaf DemoSite.
Configuration Changes
Add the following to the dependency management section to your parent
pom.xml
:<dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-jobs-events</artifactId> <version>1.0.0-GA</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-multitenant-singleschema</artifactId> <version>1.1.0-GA</version> <type>jar</type> <scope>compile</scope> </dependency>
Note: You must have previously configured your pom to reference the Broadleaf private repositories. This information will be provided as part of your license agreement.
Pull this dependency into your
core/pom.xml
:<dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-multitenant-singleschema</artifactId> </dependency> <dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-jobs-events</artifactId> </dependency>
In
applicationContext-admin-security.xml
, add the following three lines to thesec:filter-security-metadata-source
section of theblAdminFilterSecurityInterceptor
bean:<sec:intercept-url pattern="/global" access="PERMISSION_GLOBAL_ADMIN" /> <sec:intercept-url pattern="/global-*" access="PERMISSION_GLOBAL_ADMIN" /> <sec:intercept-url pattern="/global-*/**/*" access="PERMISSION_GLOBAL_ADMIN" />
Note: These lines should be the first lines in the section
In the same
applicationContext-admin-security.xml
file, add following bean:<bean id="blAdminLogoutSuccessHandler" class="com.broadleafcommerce.tenant.admin.web.BroadleafMultiTenantAdminLogoutSuccessHandler"/>
In the same
applicationContext-admin-security.xml
file, replace thesec:logout
definition with:<sec:logout invalidate-session="false" logout-url="/adminLogout.htm" success-handler-ref="blAdminLogoutSuccessHandler"/>
Ensure load time weaving is enabled for your application server. Enabling load time weaving
In
applicationContext-admin-filter.xml
, add the following filter as the last filter in theblPreSecurityFilterChain
:blMultiTenantAdminRequestFilter
Data Changes
Schema Changes
If you are allowing hibernate to create and modify your tables, this will be done automatically when you restart with the new configuration settings.
Otherwise, you will need to generate the SQL to customize your Broadleaf implementation. See the Broadleaf Schema Upgrade Documentation for details.
Admin Security Required Data Changes
To maintain multitenant configurations in the Broadleaf admin, you will need to load new permissions. The recommended changes are located in the following file:
/config/bc/sql/load_multitenant_admin_security.sql
IMPORTANT NOTE: This will give your project the basis for having site-specific admins. However, the SQL statements in those files will not account for which of your existing admin users should be mapped to which sites. This is something that must be controlled manually. Please consult the [[Data Setup Guide]] for more information. You will likely see a blank screen until you follow these instructions.
Note: In development, you can automatically load this SQL by adding this file to the blPU.hibernate.hbm2ddl.import_files property in the development-shared.properties file. Also note that if you elect to use the import_files approach, you will need to include the line above at the end of the list.
Next Steps
We recommend that after getting the module configured, start your demo site and admin and ensure that you don't have any
errors.
Once you start up successfully, move on to the Getting Started section which will help you to setup a couple of sites.