Skip to content

Commit

Permalink
also do auth reset after revoking a license plan
Browse files Browse the repository at this point in the history
  • Loading branch information
techsmyth committed Sep 20, 2024
1 parent 68b0894 commit d2aee8f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/platform/admin/licensing/admin.licensing.resolver.mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ export class AdminLicensingResolverMutations {
`assign licensePlan (${planData.licensePlanID}) on account (${planData.spaceID})`
);

const account = await this.adminLicensingService.assignLicensePlanToSpace(
const space = await this.adminLicensingService.assignLicensePlanToSpace(
planData,
licensing.id
);
// Need to trigger an authorization reset as some license credentials are used in auth policy e.g. VCs feature flag
const updatedAuthorizations =
await this.spaceAuthorizationService.applyAuthorizationPolicy(account);
await this.spaceAuthorizationService.applyAuthorizationPolicy(space);
await this.authorizationPolicyService.saveAll(updatedAuthorizations);

return account;
return space;
}

@UseGuards(GraphqlGuard)
Expand Down Expand Up @@ -128,10 +128,16 @@ export class AdminLicensingResolverMutations {
`revoke licensePlan (${planData.licensePlanID}) on account (${planData.accountID})`
);

return await this.adminLicensingService.revokeLicensePlanFromAccount(
planData,
licensing.id
);
const account =
await this.adminLicensingService.revokeLicensePlanFromAccount(
planData,
licensing.id
);
// Need to trigger an authorization reset as some license credentials are used in auth policy e.g. VCs feature flag
const updatedAuthorizations =
await this.accountAuthorizationService.applyAuthorizationPolicy(account);
await this.authorizationPolicyService.saveAll(updatedAuthorizations);
return account;
}

@UseGuards(GraphqlGuard)
Expand Down Expand Up @@ -159,9 +165,13 @@ export class AdminLicensingResolverMutations {
`revoke licensePlan (${planData.licensePlanID}) on account (${planData.spaceID})`
);

return await this.adminLicensingService.revokeLicensePlanFromSpace(
const space = await this.adminLicensingService.revokeLicensePlanFromSpace(
planData,
licensing.id
);
const updatedAuthorizations =
await this.spaceAuthorizationService.applyAuthorizationPolicy(space);
await this.authorizationPolicyService.saveAll(updatedAuthorizations);
return space;
}
}

0 comments on commit d2aee8f

Please sign in to comment.