feat(multi-tenancy): implement critical fixes for orphaned users and permissions
- Simplified HasTenantAccess permission logic to ensure every authenticated user has an account. - Added fallback to system account for OpenAI settings in AI configuration. - Allowed any authenticated user to check task progress in IntegrationSettingsViewSet. - Created a script to identify and fix orphaned users without accounts. - Updated error response handling in business endpoints for clarity.
This commit is contained in:
@@ -49,6 +49,7 @@ export default function Sites() {
|
||||
domain: '',
|
||||
description: '',
|
||||
is_active: true, // Default to true to match backend model default
|
||||
industry: undefined as number | undefined, // Industry ID - required by backend
|
||||
});
|
||||
|
||||
// Load sites and industries
|
||||
@@ -145,6 +146,7 @@ export default function Sites() {
|
||||
domain: site.domain || '',
|
||||
description: site.description || '',
|
||||
is_active: site.is_active || false,
|
||||
industry: site.industry,
|
||||
});
|
||||
setShowDetailsModal(true);
|
||||
};
|
||||
@@ -177,6 +179,7 @@ export default function Sites() {
|
||||
domain: '',
|
||||
description: '',
|
||||
is_active: true, // Default to true to match backend model default
|
||||
industry: undefined,
|
||||
});
|
||||
setShowSiteModal(true);
|
||||
};
|
||||
@@ -188,6 +191,7 @@ export default function Sites() {
|
||||
domain: site.domain || '',
|
||||
description: site.description || '',
|
||||
is_active: site.is_active || false,
|
||||
industry: site.industry,
|
||||
});
|
||||
setShowSiteModal(true);
|
||||
};
|
||||
@@ -247,6 +251,7 @@ export default function Sites() {
|
||||
domain: '',
|
||||
description: '',
|
||||
is_active: false,
|
||||
industry: undefined,
|
||||
});
|
||||
await loadSites();
|
||||
} catch (error: any) {
|
||||
@@ -313,6 +318,22 @@ export default function Sites() {
|
||||
required: true,
|
||||
placeholder: 'Enter site name',
|
||||
},
|
||||
{
|
||||
key: 'industry',
|
||||
label: 'Industry',
|
||||
type: 'select',
|
||||
value: formData.industry?.toString() || '',
|
||||
onChange: (value: any) => setFormData({ ...formData, industry: value ? parseInt(value) : undefined }),
|
||||
required: true,
|
||||
placeholder: 'Select an industry',
|
||||
options: [
|
||||
{ value: '', label: 'Select an industry...' },
|
||||
...industries.map(industry => ({
|
||||
value: industry.id.toString(),
|
||||
label: industry.name,
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'domain',
|
||||
label: 'Domain',
|
||||
@@ -428,6 +449,7 @@ export default function Sites() {
|
||||
domain: '',
|
||||
description: '',
|
||||
is_active: false,
|
||||
industry: undefined,
|
||||
});
|
||||
}}
|
||||
onSubmit={handleSaveSite}
|
||||
|
||||
Reference in New Issue
Block a user