Implement custom roles and improve permissions logic

The commit refactors the handling of account roles and enhances permissions checks. The account role has been shifted to use a string type, providing the ability to define custom roles. It also introduces the RolesDataProvider component, which stipulates role-related data for different forms and tables. The modification goes further to consider user role hierarchy in permissions checks, offering a more granular access control.
This commit is contained in:
giancarlo
2024-03-29 14:48:45 +08:00
parent f1967a686c
commit 99db8f4ca4
41 changed files with 498 additions and 228 deletions

View File

@@ -180,7 +180,7 @@ export class StripeWebhookHandlerService
const { subscription } = params;
const lineItem = subscription.items.data[0];
const price = lineItem?.price;
const priceId = price?.id!;
const priceId = price?.id as string;
const interval = price?.recurring?.interval ?? null;
const active =
@@ -194,8 +194,8 @@ export class StripeWebhookHandlerService
price_amount: params.amount,
cancel_at_period_end: subscription.cancel_at_period_end ?? false,
interval: interval as string,
currency: price?.currency as string,
product_id: price?.product as string,
currency: (price as Stripe.Price).currency,
product_id: (price as Stripe.Price).product,
variant_id: priceId,
interval_count: price?.recurring?.interval_count ?? 1,
period_starts_at: getISOString(subscription.current_period_start),