feat: add interface user permission (#20424)
* feat: add interface user permission Adds admin configurable user / group permissions for the interface settings section * rename
This commit is contained in:
@@ -91,6 +91,9 @@
|
||||
web_search: true,
|
||||
image_generation: true,
|
||||
code_interpreter: true
|
||||
},
|
||||
settings: {
|
||||
interface: true
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
web_search: true,
|
||||
image_generation: true,
|
||||
code_interpreter: true
|
||||
},
|
||||
settings: {
|
||||
interface: true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +82,8 @@
|
||||
workspace: { ...defaults.workspace, ...obj.workspace },
|
||||
sharing: { ...defaults.sharing, ...obj.sharing },
|
||||
chat: { ...defaults.chat, ...obj.chat },
|
||||
features: { ...defaults.features, ...obj.features }
|
||||
features: { ...defaults.features, ...obj.features },
|
||||
settings: { ...defaults.settings, ...obj.settings }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -839,4 +843,26 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100/30 dark:border-gray-850/30" />
|
||||
|
||||
<div>
|
||||
<div class=" mb-2 text-sm font-medium">{$i18n.t('Settings Permissions')}</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('Interface Settings Access')}
|
||||
</div>
|
||||
<Switch bind:state={permissions.settings.interface} />
|
||||
</div>
|
||||
{#if defaultPermissions?.settings?.interface && !permissions.settings.interface}
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -487,6 +487,10 @@
|
||||
);
|
||||
}
|
||||
|
||||
if (tab.id === 'interface') {
|
||||
return $user?.role === 'admin' || ($user?.permissions?.settings?.interface ?? true);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user