-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into server-4772
- Loading branch information
Showing
12 changed files
with
282 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class LicensePolicyLimits1734708463555 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const [licensePolicy]: { | ||
id: string; | ||
}[] = await queryRunner.query(`SELECT id FROM license_policy`); | ||
await queryRunner.query( | ||
`UPDATE license_policy SET credentialRulesStr = ? WHERE id = ?`, | ||
[`${JSON.stringify(licenseCredentialRules)}`, licensePolicy.id] | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
console.log('No down migration needed'); | ||
} | ||
} | ||
|
||
type CredentialRule = { | ||
credentialType: LicenseCredential; | ||
grantedEntitlements: GrantedEntitlement[]; | ||
name: string; | ||
}; | ||
|
||
type GrantedEntitlement = { | ||
type: LicenseEntitlementType; | ||
limit: number; | ||
}; | ||
|
||
enum LicenseCredential { | ||
SPACE_LICENSE_FREE = 'space-license-free', | ||
SPACE_LICENSE_PLUS = 'space-license-plus', | ||
SPACE_LICENSE_PREMIUM = 'space-license-premium', | ||
SPACE_LICENSE_ENTERPRISE = 'space-license-enterprise', // todo: remove for space | ||
SPACE_FEATURE_SAVE_AS_TEMPLATE = 'space-feature-save-as-template', | ||
SPACE_FEATURE_VIRTUAL_CONTRIBUTORS = 'space-feature-virtual-contributors', | ||
SPACE_FEATURE_WHITEBOARD_MULTI_USER = 'space-feature-whiteboard-multi-user', | ||
ACCOUNT_LICENSE_PLUS = 'account-license-plus', | ||
} | ||
|
||
enum LicenseEntitlementType { | ||
ACCOUNT_SPACE_FREE = 'account-space-free', | ||
ACCOUNT_SPACE_PLUS = 'account-space-plus', | ||
ACCOUNT_SPACE_PREMIUM = 'account-space-premium', | ||
ACCOUNT_VIRTUAL_CONTRIBUTOR = 'account-virtual-contributor', | ||
ACCOUNT_INNOVATION_PACK = 'account-innovation-pack', | ||
ACCOUNT_INNOVATION_HUB = 'account-innovation-hub', | ||
SPACE_FREE = 'space-free', | ||
SPACE_PLUS = 'space-plus', | ||
SPACE_PREMIUM = 'space-premium', | ||
SPACE_FLAG_SAVE_AS_TEMPLATE = 'space-flag-save-as-template', | ||
SPACE_FLAG_VIRTUAL_CONTRIBUTOR_ACCESS = 'space-flag-virtual-contributor-access', | ||
SPACE_FLAG_WHITEBOARD_MULTI_USER = 'space-flag-whiteboard-multi-user', | ||
} | ||
|
||
const licenseCredentialRules: CredentialRule[] = [ | ||
{ | ||
credentialType: LicenseCredential.SPACE_FEATURE_VIRTUAL_CONTRIBUTORS, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_VIRTUAL_CONTRIBUTOR_ACCESS, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space Virtual Contributors', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.SPACE_FEATURE_WHITEBOARD_MULTI_USER, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_WHITEBOARD_MULTI_USER, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space Multi-user whiteboards', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.SPACE_FEATURE_SAVE_AS_TEMPLATE, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_SAVE_AS_TEMPLATE, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space Save As Template', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.SPACE_LICENSE_FREE, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_FREE, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space License Free', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.SPACE_LICENSE_PLUS, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_PLUS, | ||
limit: 1, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_WHITEBOARD_MULTI_USER, | ||
limit: 1, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_SAVE_AS_TEMPLATE, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space License Plus', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.SPACE_LICENSE_PREMIUM, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.SPACE_PREMIUM, | ||
limit: 1, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_WHITEBOARD_MULTI_USER, | ||
limit: 1, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.SPACE_FLAG_SAVE_AS_TEMPLATE, | ||
limit: 1, | ||
}, | ||
], | ||
name: 'Space License Premium', | ||
}, | ||
{ | ||
credentialType: LicenseCredential.ACCOUNT_LICENSE_PLUS, | ||
grantedEntitlements: [ | ||
{ | ||
type: LicenseEntitlementType.ACCOUNT_SPACE_FREE, | ||
limit: 3, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.ACCOUNT_VIRTUAL_CONTRIBUTOR, | ||
limit: 3, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.ACCOUNT_INNOVATION_HUB, | ||
limit: 1, | ||
}, | ||
{ | ||
type: LicenseEntitlementType.ACCOUNT_INNOVATION_PACK, | ||
limit: 3, | ||
}, | ||
], | ||
name: 'Account License Plus', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...atform/licensing/credential-based/licensing-credential-based-entitlements-engine/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './licensing.credential.based.policy.rule.credential.interface'; | ||
export * from './licensing.credential.based.policy.credential.rule.interface'; |
6 changes: 3 additions & 3 deletions
6
...based.policy.rule.credential.interface.ts → ...based.policy.credential.rule.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...redential.based.policy.rule.credential.ts → ...redential.based.policy.credential.rule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.