diff --git a/services/tenant-management-service/migrations/pg/migrations/20240925102459-add-table-tenant-configs.js b/services/tenant-management-service/migrations/pg/migrations/20240925102459-add-table-tenant-configs.js index 2052c51..9e7d6e8 100644 --- a/services/tenant-management-service/migrations/pg/migrations/20240925102459-add-table-tenant-configs.js +++ b/services/tenant-management-service/migrations/pg/migrations/20240925102459-add-table-tenant-configs.js @@ -8,46 +8,52 @@ var path = require('path'); var Promise; /** - * We receive the dbmigrate dependency from dbmigrate initially. - * This enables us to not have to rely on NODE_PATH. - */ -exports.setup = function(options, seedLink) { + * We receive the dbmigrate dependency from dbmigrate initially. + * This enables us to not have to rely on NODE_PATH. + */ +exports.setup = function (options, seedLink) { dbm = options.dbmigrate; type = dbm.dataType; seed = seedLink; Promise = options.Promise; }; -exports.up = function(db) { - var filePath = path.join(__dirname, 'sqls', '20240925102459-add-table-tenant-configs-up.sql'); - return new Promise( function( resolve, reject ) { - fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ +exports.up = function (db) { + var filePath = path.join( + __dirname, + 'sqls', + '20240925102459-add-table-tenant-configs-up.sql', + ); + return new Promise(function (resolve, reject) { + fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) { if (err) return reject(err); console.log('received data: ' + data); resolve(data); }); - }) - .then(function(data) { + }).then(function (data) { return db.runSql(data); }); }; -exports.down = function(db) { - var filePath = path.join(__dirname, 'sqls', '20240925102459-add-table-tenant-configs-down.sql'); - return new Promise( function( resolve, reject ) { - fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ +exports.down = function (db) { + var filePath = path.join( + __dirname, + 'sqls', + '20240925102459-add-table-tenant-configs-down.sql', + ); + return new Promise(function (resolve, reject) { + fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) { if (err) return reject(err); console.log('received data: ' + data); resolve(data); }); - }) - .then(function(data) { + }).then(function (data) { return db.runSql(data); }); }; exports._meta = { - "version": 1 + version: 1, }; diff --git a/services/tenant-management-service/src/component.ts b/services/tenant-management-service/src/component.ts index 6c34876..4b01dfb 100644 --- a/services/tenant-management-service/src/component.ts +++ b/services/tenant-management-service/src/component.ts @@ -38,6 +38,7 @@ import { LeadTenantController, PingController, TenantConfigController, + TenantConfigTenantController, TenantController, } from './controllers'; import {InvoiceController} from './controllers/invoice.controller'; @@ -85,7 +86,6 @@ import { ProvisioningService, } from './services'; import {ITenantManagementServiceConfig} from './types'; -import {TenantConfigTenantController} from '@sourceloop/ctrl-plane-tenant-management-service/dist/controllers'; export class TenantManagementServiceComponent implements Component { constructor( diff --git a/services/tenant-management-service/src/permissions.ts b/services/tenant-management-service/src/permissions.ts index be005a3..2eface1 100644 --- a/services/tenant-management-service/src/permissions.ts +++ b/services/tenant-management-service/src/permissions.ts @@ -22,11 +22,10 @@ export const PermissionKey = { UpdateSubscription: '7002', ViewSubscription: '7004', ViewPlan: '7008', - CreateTenantConfig: '10216', - - UpdateTenantConfig: '10217', - DeleteTenantConfig: '10218', - ViewTenantConfig: '10219', + CreateTenantConfig: '10220', + ViewTenantConfig: '10221', + UpdateTenantConfig: '10222', + DeleteTenantConfig: '10223', // notification service ViewNotificationTemplate: '8000', diff --git a/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts b/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts index 2f200e6..0c5f2f0 100644 --- a/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts +++ b/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts @@ -47,6 +47,17 @@ export class Auth0IdpProvider name: tenant.name, // eslint-disable-next-line display_name: configValue.display_name, + branding: { + // eslint-disable-next-line + logo_url: configValue.logo_url, + colors: { + primary: configValue.primary_color, + // eslint-disable-next-line + page_background: configValue.page_background, + }, + }, + // eslint-disable-next-line + enabled_connections: configValue.enabled_connections, }; const userData: UserCreate = { @@ -113,14 +124,7 @@ export class Auth0IdpProvider } async createOrganization(data: PostOrganizationsRequest) { try { - return await this.management.organizations.create({ - name: data.name, - // eslint-disable-next-line - display_name: data.display_name, - branding: {}, - // eslint-disable-next-line - enabled_connections: [], - }); + return await this.management.organizations.create(data); } catch (error) { throw new Error(`Error creating organization: ${error.message}`); } @@ -145,5 +149,4 @@ export class Auth0IdpProvider throw new Error(`Error adding member to organization: ${error.message}`); } } - } diff --git a/services/tenant-management-service/src/types/i-idp.interface.ts b/services/tenant-management-service/src/types/i-idp.interface.ts index bc2c1c2..31129d0 100644 --- a/services/tenant-management-service/src/types/i-idp.interface.ts +++ b/services/tenant-management-service/src/types/i-idp.interface.ts @@ -10,7 +10,7 @@ export enum IdPKey { export type ConfigureIdpFunc = (payload: IdpDetails) => Promise; export interface IdpDetails { - plan: AnyObject; identityProvider: IdPKey; tenant: Tenant; + plan: AnyObject; } diff --git a/services/tenant-management-service/src/webhook.component.ts b/services/tenant-management-service/src/webhook.component.ts index 21c1acf..0df2886 100644 --- a/services/tenant-management-service/src/webhook.component.ts +++ b/services/tenant-management-service/src/webhook.component.ts @@ -70,11 +70,7 @@ import { SaasTenantRepository, } from './repositories'; import {WebhookVerifierProvider} from './interceptors'; -import { - Auth0IdpProvider, - KeycloakIdpProvider, - SystemUserProvider, -} from './providers'; +import {KeycloakIdpProvider, SystemUserProvider} from './providers'; import {CryptoHelperService, NotificationService} from './services'; import { DEFAULT_SIGNATURE_HEADER, @@ -82,6 +78,7 @@ import { DEFAULT_TIMESTAMP_TOLERANCE, } from './utils'; import {ProvisioningWebhookHandler} from './services/webhook'; +import {Auth0IdpProvider} from './providers/idp/idp-auth0.provider'; export class WebhookTenantManagementServiceComponent implements Component { constructor(