feat(permissions): add per-group features.user_webhooks permission (#25923)
This commit is contained in:
@@ -2813,6 +2813,10 @@ USER_PERMISSIONS_FEATURES_AUTOMATIONS = os.getenv('USER_PERMISSIONS_FEATURES_AUT
|
||||
|
||||
USER_PERMISSIONS_FEATURES_CALENDAR = os.getenv('USER_PERMISSIONS_FEATURES_CALENDAR', 'True').lower() == 'true'
|
||||
|
||||
USER_PERMISSIONS_FEATURES_USER_WEBHOOKS = (
|
||||
os.getenv('USER_PERMISSIONS_FEATURES_USER_WEBHOOKS', 'False').lower() == 'true'
|
||||
)
|
||||
|
||||
|
||||
USER_PERMISSIONS_SETTINGS_INTERFACE = os.getenv('USER_PERMISSIONS_SETTINGS_INTERFACE', 'True').lower() == 'true'
|
||||
|
||||
@@ -2888,6 +2892,7 @@ DEFAULT_USER_PERMISSIONS = {
|
||||
'memories': USER_PERMISSIONS_FEATURES_MEMORIES,
|
||||
'automations': USER_PERMISSIONS_FEATURES_AUTOMATIONS,
|
||||
'calendar': USER_PERMISSIONS_FEATURES_CALENDAR,
|
||||
'user_webhooks': USER_PERMISSIONS_FEATURES_USER_WEBHOOKS,
|
||||
},
|
||||
'settings': {
|
||||
'interface': USER_PERMISSIONS_SETTINGS_INTERFACE,
|
||||
|
||||
@@ -239,6 +239,7 @@ class FeaturesPermissions(BaseModel):
|
||||
memories: bool = True
|
||||
automations: bool = False
|
||||
calendar: bool = True
|
||||
user_webhooks: bool = False
|
||||
|
||||
|
||||
class SettingsPermissions(BaseModel):
|
||||
|
||||
@@ -1001,6 +1001,22 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex w-full justify-between my-1">
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('User Webhooks')}
|
||||
</div>
|
||||
<Switch bind:state={permissions.features.user_webhooks} />
|
||||
</div>
|
||||
{#if defaultPermissions?.features?.user_webhooks && !permissions.features.user_webhooks}
|
||||
<div>
|
||||
<div class="text-xs text-gray-500">
|
||||
{$i18n.t('This is a default user permission and will remain enabled.')}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100/30 dark:border-gray-850/30" />
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $config?.features?.enable_user_webhooks}
|
||||
{#if $config?.features?.enable_user_webhooks && ($user?.role === 'admin' || ($user?.permissions?.features?.user_webhooks ?? false))}
|
||||
<div class="mt-2">
|
||||
<div class="flex flex-col w-full">
|
||||
<div class=" mb-1 text-xs font-medium">{$i18n.t('Notification Webhook')}</div>
|
||||
|
||||
@@ -66,7 +66,8 @@ export const DEFAULT_PERMISSIONS = {
|
||||
code_interpreter: true,
|
||||
memories: true,
|
||||
automations: false,
|
||||
calendar: true
|
||||
calendar: true,
|
||||
user_webhooks: false
|
||||
},
|
||||
settings: {
|
||||
interface: true
|
||||
|
||||
Reference in New Issue
Block a user