diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 4dfa6dea9..e2e7d7ea1 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1454,6 +1454,10 @@ USER_PERMISSIONS_CHAT_FILE_UPLOAD = ( os.environ.get("USER_PERMISSIONS_CHAT_FILE_UPLOAD", "True").lower() == "true" ) +USER_PERMISSIONS_CHAT_WEB_UPLOAD = ( + os.environ.get("USER_PERMISSIONS_CHAT_WEB_UPLOAD", "True").lower() == "true" +) + USER_PERMISSIONS_CHAT_DELETE = ( os.environ.get("USER_PERMISSIONS_CHAT_DELETE", "True").lower() == "true" ) @@ -1592,6 +1596,7 @@ DEFAULT_USER_PERMISSIONS = { "system_prompt": USER_PERMISSIONS_CHAT_SYSTEM_PROMPT, "params": USER_PERMISSIONS_CHAT_PARAMS, "file_upload": USER_PERMISSIONS_CHAT_FILE_UPLOAD, + "web_upload": USER_PERMISSIONS_CHAT_WEB_UPLOAD, "delete": USER_PERMISSIONS_CHAT_DELETE, "delete_message": USER_PERMISSIONS_CHAT_DELETE_MESSAGE, "continue_response": USER_PERMISSIONS_CHAT_CONTINUE_RESPONSE, diff --git a/backend/open_webui/routers/users.py b/backend/open_webui/routers/users.py index f231c0e51..1ecf1c019 100644 --- a/backend/open_webui/routers/users.py +++ b/backend/open_webui/routers/users.py @@ -202,6 +202,7 @@ class ChatPermissions(BaseModel): system_prompt: bool = True params: bool = True file_upload: bool = True + web_upload: bool = True delete: bool = True delete_message: bool = True continue_response: bool = True diff --git a/src/lib/components/admin/Users/Groups/Permissions.svelte b/src/lib/components/admin/Users/Groups/Permissions.svelte index f50170dca..820228de0 100644 --- a/src/lib/components/admin/Users/Groups/Permissions.svelte +++ b/src/lib/components/admin/Users/Groups/Permissions.svelte @@ -414,6 +414,22 @@ {/if} +
+
+
+ {$i18n.t('Allow Web Upload')} +
+ +
+ {#if defaultPermissions?.chat?.web_upload && !permissions.chat.web_upload} +
+
+ {$i18n.t('This is a default user permission and will remain enabled.')} +
+
+ {/if} +
+
diff --git a/src/lib/components/chat/MessageInput/InputMenu.svelte b/src/lib/components/chat/MessageInput/InputMenu.svelte index 6e2d7724b..7cc280b5b 100644 --- a/src/lib/components/chat/MessageInput/InputMenu.svelte +++ b/src/lib/components/chat/MessageInput/InputMenu.svelte @@ -56,6 +56,10 @@ fileUploadCapableModels.length === selectedModels.length && ($user?.role === 'admin' || $user?.permissions?.chat?.file_upload); + let webUploadEnabled = true; + $: webUploadEnabled = + $user?.role === 'admin' || ($user?.permissions?.chat?.web_upload ?? true); + $: if (!fileUploadEnabled && files.length > 0) { files = []; } @@ -185,19 +189,17 @@ { - if (fileUploadEnabled) { + if (webUploadEnabled) { showAttachWebpageModal = true; } }} diff --git a/src/lib/constants/permissions.ts b/src/lib/constants/permissions.ts index 0a342243a..531f3fea8 100644 --- a/src/lib/constants/permissions.ts +++ b/src/lib/constants/permissions.ts @@ -32,6 +32,7 @@ export const DEFAULT_PERMISSIONS = { system_prompt: true, params: true, file_upload: true, + web_upload: true, delete: true, delete_message: true, continue_response: true,