From 640961904eb546c7e4db5c9752aa383ab27659db Mon Sep 17 00:00:00 2001 From: poduck Date: Fri, 28 Nov 2025 04:00:42 -0500 Subject: [PATCH] feat: Add comprehensive permissions to BusinessEditModal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend Changes: - Add all 5 platform permissions to BusinessEditModal (matching TenantInviteModal) - Manage OAuth Credentials - Accept Online Payments (Stripe Connect) - Use Custom Domain - Remove Branding (White Label) - API Access - Add "Coming Soon" feature limits section with 11 future capabilities - Video conferencing - Event types limits (unlimited or custom) - Calendar connections limits (unlimited or custom) - External API connections - Repeated/recurring events - 2FA requirement - System logs download - Data deletion - Masked phone numbers - POS system integration - Mobile app access - Update TypeScript interfaces to include all permission fields - PlatformBusiness: Add 4 new required boolean fields - PlatformBusinessUpdate: Add 4 new optional boolean fields Backend Changes: - Update TenantUpdateSerializer to accept all 5 permission fields - can_manage_oauth_credentials - can_accept_payments - can_use_custom_domain - can_white_label - can_api_access UI Improvements: - All permissions displayed with toggle switches and descriptions - Purple theme for permission toggles - Gray card backgrounds for visual separation - "Coming Soon" badge with yellow styling - Disabled state (opacity-50) for future features - Proper spacing and layout consistency Result: - BusinessEditModal now has complete feature parity with TenantInviteModal - Platform admins can view and modify all current permissions - Clear visibility into planned features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- frontend/src/api/platform.ts | 8 + .../platform/components/BusinessEditModal.tsx | 309 +++++++++++++++++- smoothschedule/platform_admin/serializers.py | 4 + 3 files changed, 304 insertions(+), 17 deletions(-) diff --git a/frontend/src/api/platform.ts b/frontend/src/api/platform.ts index 9cff902..cbe02a9 100644 --- a/frontend/src/api/platform.ts +++ b/frontend/src/api/platform.ts @@ -28,6 +28,10 @@ export interface PlatformBusiness { phone?: string; // Platform permissions can_manage_oauth_credentials: boolean; + can_accept_payments: boolean; + can_use_custom_domain: boolean; + can_white_label: boolean; + can_api_access: boolean; } export interface PlatformBusinessUpdate { @@ -37,6 +41,10 @@ export interface PlatformBusinessUpdate { max_users?: number; max_resources?: number; can_manage_oauth_credentials?: boolean; + can_accept_payments?: boolean; + can_use_custom_domain?: boolean; + can_white_label?: boolean; + can_api_access?: boolean; } export interface PlatformBusinessCreate { diff --git a/frontend/src/pages/platform/components/BusinessEditModal.tsx b/frontend/src/pages/platform/components/BusinessEditModal.tsx index ae9c550..56c3256 100644 --- a/frontend/src/pages/platform/components/BusinessEditModal.tsx +++ b/frontend/src/pages/platform/components/BusinessEditModal.tsx @@ -19,6 +19,24 @@ const BusinessEditModal: React.FC = ({ business, isOpen, max_users: 5, max_resources: 10, can_manage_oauth_credentials: false, + can_accept_payments: false, + can_use_custom_domain: false, + can_white_label: false, + can_api_access: false, + // New feature limits (not yet implemented) + limits: { + can_add_video_conferencing: false, + max_event_types: null as number | null, + max_calendars_connected: null as number | null, + can_connect_to_api: false, + can_book_repeated_events: false, + can_require_2fa: false, + can_download_logs: false, + can_delete_data: false, + can_use_masked_phone_numbers: false, + can_use_pos: false, + can_use_mobile_app: false, + }, }); // Update form when business changes @@ -31,6 +49,23 @@ const BusinessEditModal: React.FC = ({ business, isOpen, max_users: business.max_users || 5, max_resources: business.max_resources || 10, can_manage_oauth_credentials: business.can_manage_oauth_credentials || false, + can_accept_payments: business.can_accept_payments || false, + can_use_custom_domain: business.can_use_custom_domain || false, + can_white_label: business.can_white_label || false, + can_api_access: business.can_api_access || false, + limits: { + can_add_video_conferencing: false, + max_event_types: null, + max_calendars_connected: null, + can_connect_to_api: false, + can_book_repeated_events: false, + can_require_2fa: false, + can_download_logs: false, + can_delete_data: false, + can_use_masked_phone_numbers: false, + can_use_pos: false, + can_use_mobile_app: false, + }, }); } }, [business]); @@ -156,24 +191,264 @@ const BusinessEditModal: React.FC = ({ business, isOpen, Platform Permissions - {/* Can Manage OAuth Credentials */} -
-
- -

- Allow this business to configure their own OAuth app credentials -

+
+ {/* Can Manage OAuth Credentials */} +
+
+ +

+ Allow this business to configure their own OAuth app credentials +

+
+
- + + {/* Can Accept Payments */} +
+
+ +

+ Enable Stripe Connect for payment processing +

+
+ +
+ + {/* Can Use Custom Domain */} +
+
+ +

+ Allow custom domain configuration +

+
+ +
+ + {/* Can White Label */} +
+
+ +

+ Allow removal of SmoothSchedule branding +

+
+ +
+ + {/* Can API Access */} +
+
+ +

+ Enable API access for integrations +

+
+ +
+
+
+ + {/* Feature Limits (Not Yet Implemented) */} +
+
+ + + Coming Soon + +
+
+ {/* Video Conferencing */} + + + {/* Event Types Limit */} +
+ +
+
+ Unlimited event types +
+ +
+
+ + {/* Calendars Connected Limit */} +
+ +
+
+ Unlimited calendar connections +
+ +
+
+ + {/* API Access */} + + + {/* Repeated Events */} + + + {/* 2FA */} + + + {/* Download Logs */} + + + {/* Delete Data */} + + + {/* Masked Phone Numbers */} + + + {/* POS Integration */} + + + {/* Mobile App */} +
diff --git a/smoothschedule/platform_admin/serializers.py b/smoothschedule/platform_admin/serializers.py index f0bb3c9..f9fc2b8 100644 --- a/smoothschedule/platform_admin/serializers.py +++ b/smoothschedule/platform_admin/serializers.py @@ -72,6 +72,10 @@ class TenantUpdateSerializer(serializers.ModelSerializer): 'max_users', 'max_resources', # Platform permissions 'can_manage_oauth_credentials', + 'can_accept_payments', + 'can_use_custom_domain', + 'can_white_label', + 'can_api_access', ] read_only_fields = ['id']