support schema per tenant multi-tenancy. basic auth security filter is extended to detect tenant-id header on request, verify tenant id is valid and then use provided credentials to authenticate user details against users on the tenant specific schema.

This commit is contained in:
Keith Woodlock
2012-07-13 18:05:43 +01:00
parent 816d3decf9
commit 15f0fc4677
34 changed files with 399 additions and 195 deletions
@@ -1,3 +1,7 @@
/* remove column org_id */
ALTER TABLE `mifosngprovider`.`portfolio_client` DROP FOREIGN KEY `FKCE00CAB354DF2770` ;ALTER TABLE `mifosngprovider`.`portfolio_client` DROP COLUMN `org_id` , DROP INDEX `org_id` , ADD INDEX `external_id` (`external_id` ASC) , DROP INDEX `FKCE00CAB354DF2770` ;
ALTER TABLE `portfolio_client` DROP FOREIGN KEY `FKCE00CAB354DF2770`;
ALTER TABLE `portfolio_client`
DROP COLUMN `org_id` ,
DROP INDEX `org_id` ,
ADD INDEX `external_id` (`external_id` ASC) ,
DROP INDEX `FKCE00CAB354DF2770`;
@@ -1,5 +1,5 @@
-- create fund table
DROP TABLE IF EXISTS `mifosngprovider`.`org_fund`;
DROP TABLE IF EXISTS `org_fund`;
CREATE TABLE `org_fund` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) NOT NULL,
@@ -21,13 +21,13 @@ CREATE TABLE `org_fund` (
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- example of dropping fund column/index/foreign key
-- alter table `mifosngprovider`.`portfolio_product_loan`
-- alter table `portfolio_product_loan`
-- DROP FOREIGN KEY `FKA6A8A7D77240145`,
-- DROP INDEX `FKA6A8A7D77240145`,
-- drop column `fund_id`;
-- associate fund table with loan products making it fund optional at database level
alter table `mifosngprovider`.`portfolio_product_loan`
alter table `portfolio_product_loan`
add column `fund_id` bigint(20) DEFAULT NULL,
add KEY `FKA6A8A7D77240145` (`fund_id`),
add CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`);
@@ -1,11 +1,11 @@
-- example of dropping fund column/index/foreign key
-- alter table `mifosngprovider`.`portfolio_loan`
-- alter table `portfolio_loan`
-- DROP FOREIGN KEY `FK7C885877240145`,
-- DROP INDEX `FK7C885877240145`,
-- drop column `fund_id`;
-- associate fund table with loans making fund optional at database level
alter table `mifosngprovider`.`portfolio_loan`
alter table `portfolio_loan`
add column `fund_id` bigint(20) DEFAULT NULL,
add KEY `FK7C885877240145` (`fund_id`),
add CONSTRAINT `FK7C885877240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`);
@@ -1,5 +1,5 @@
-- create fund table
DROP TABLE IF EXISTS `mifosngprovider`.`portfolio_office_monetary_transfers`;
DROP TABLE IF EXISTS `portfolio_office_monetary_transfers`;
CREATE TABLE `portfolio_office_monetary_transfers` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`from_office_id` bigint(20) DEFAULT NULL,
@@ -1,6 +1,6 @@
-- create office transaction table
DROP TABLE IF EXISTS `mifosngprovider`.`portfolio_office_monetary_transfers`;
DROP TABLE IF EXISTS `mifosngprovider`.`portfolio_office_transaction`;
DROP TABLE IF EXISTS `portfolio_office_monetary_transfers`;
DROP TABLE IF EXISTS `portfolio_office_transaction`;
CREATE TABLE `portfolio_office_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`from_office_id` bigint(20) DEFAULT NULL,