chore: aggregation (#20430)
* Update EditGroupModal.svelte * Update Permissions.svelte * Create permissions.ts
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
import General from './General.svelte';
|
import General from './General.svelte';
|
||||||
import Permissions from './Permissions.svelte';
|
import Permissions from './Permissions.svelte';
|
||||||
import Users from './Users.svelte';
|
import Users from './Users.svelte';
|
||||||
|
import { DEFAULT_PERMISSIONS } from '$lib/constants/permissions';
|
||||||
import UserPlusSolid from '$lib/components/icons/UserPlusSolid.svelte';
|
import UserPlusSolid from '$lib/components/icons/UserPlusSolid.svelte';
|
||||||
import WrenchSolid from '$lib/components/icons/WrenchSolid.svelte';
|
import WrenchSolid from '$lib/components/icons/WrenchSolid.svelte';
|
||||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||||
@@ -36,66 +37,7 @@
|
|||||||
export let description = '';
|
export let description = '';
|
||||||
export let data = {};
|
export let data = {};
|
||||||
|
|
||||||
export let permissions = {
|
export let permissions = DEFAULT_PERMISSIONS;
|
||||||
workspace: {
|
|
||||||
models: false,
|
|
||||||
knowledge: false,
|
|
||||||
prompts: false,
|
|
||||||
tools: false,
|
|
||||||
models_import: false,
|
|
||||||
models_export: false,
|
|
||||||
prompts_import: false,
|
|
||||||
prompts_export: false,
|
|
||||||
tools_import: false,
|
|
||||||
tools_export: false
|
|
||||||
},
|
|
||||||
sharing: {
|
|
||||||
models: false,
|
|
||||||
public_models: false,
|
|
||||||
knowledge: false,
|
|
||||||
public_knowledge: false,
|
|
||||||
prompts: false,
|
|
||||||
public_prompts: false,
|
|
||||||
tools: false,
|
|
||||||
public_tools: false,
|
|
||||||
notes: false,
|
|
||||||
public_notes: false
|
|
||||||
},
|
|
||||||
chat: {
|
|
||||||
controls: true,
|
|
||||||
valves: true,
|
|
||||||
system_prompt: true,
|
|
||||||
params: true,
|
|
||||||
file_upload: true,
|
|
||||||
delete: true,
|
|
||||||
delete_message: true,
|
|
||||||
continue_response: true,
|
|
||||||
regenerate_response: true,
|
|
||||||
rate_response: true,
|
|
||||||
edit: true,
|
|
||||||
share: true,
|
|
||||||
export: true,
|
|
||||||
stt: true,
|
|
||||||
tts: true,
|
|
||||||
call: true,
|
|
||||||
multiple_models: true,
|
|
||||||
temporary: true,
|
|
||||||
temporary_enforced: false
|
|
||||||
},
|
|
||||||
features: {
|
|
||||||
api_keys: false,
|
|
||||||
notes: true,
|
|
||||||
channels: true,
|
|
||||||
folders: true,
|
|
||||||
direct_tool_servers: false,
|
|
||||||
web_search: true,
|
|
||||||
image_generation: true,
|
|
||||||
code_interpreter: true
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
interface: true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
@@ -117,7 +59,15 @@
|
|||||||
if (group) {
|
if (group) {
|
||||||
name = group.name;
|
name = group.name;
|
||||||
description = group.description;
|
description = group.description;
|
||||||
permissions = group?.permissions ?? {};
|
const loadedPermissions = group?.permissions ?? {};
|
||||||
|
// Create fresh object from defaults, then overlay loaded values
|
||||||
|
permissions = {
|
||||||
|
workspace: { ...DEFAULT_PERMISSIONS.workspace, ...loadedPermissions.workspace },
|
||||||
|
sharing: { ...DEFAULT_PERMISSIONS.sharing, ...loadedPermissions.sharing },
|
||||||
|
chat: { ...DEFAULT_PERMISSIONS.chat, ...loadedPermissions.chat },
|
||||||
|
features: { ...DEFAULT_PERMISSIONS.features, ...loadedPermissions.features },
|
||||||
|
settings: { ...DEFAULT_PERMISSIONS.settings, ...loadedPermissions.settings }
|
||||||
|
};
|
||||||
data = group?.data ?? {};
|
data = group?.data ?? {};
|
||||||
|
|
||||||
userCount = group?.member_count ?? 0;
|
userCount = group?.member_count ?? 0;
|
||||||
|
|||||||
@@ -5,67 +5,7 @@
|
|||||||
import Switch from '$lib/components/common/Switch.svelte';
|
import Switch from '$lib/components/common/Switch.svelte';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
||||||
// Default values for permissions
|
import { DEFAULT_PERMISSIONS } from '$lib/constants/permissions';
|
||||||
const DEFAULT_PERMISSIONS = {
|
|
||||||
workspace: {
|
|
||||||
models: false,
|
|
||||||
knowledge: false,
|
|
||||||
prompts: false,
|
|
||||||
tools: false,
|
|
||||||
models_import: false,
|
|
||||||
models_export: false,
|
|
||||||
prompts_import: false,
|
|
||||||
prompts_export: false,
|
|
||||||
tools_import: false,
|
|
||||||
tools_export: false
|
|
||||||
},
|
|
||||||
sharing: {
|
|
||||||
models: false,
|
|
||||||
public_models: false,
|
|
||||||
knowledge: false,
|
|
||||||
public_knowledge: false,
|
|
||||||
prompts: false,
|
|
||||||
public_prompts: false,
|
|
||||||
tools: false,
|
|
||||||
public_tools: false,
|
|
||||||
notes: false,
|
|
||||||
public_notes: false
|
|
||||||
},
|
|
||||||
chat: {
|
|
||||||
controls: true,
|
|
||||||
valves: true,
|
|
||||||
system_prompt: true,
|
|
||||||
params: true,
|
|
||||||
file_upload: true,
|
|
||||||
delete: true,
|
|
||||||
delete_message: true,
|
|
||||||
continue_response: true,
|
|
||||||
regenerate_response: true,
|
|
||||||
rate_response: true,
|
|
||||||
edit: true,
|
|
||||||
share: true,
|
|
||||||
export: true,
|
|
||||||
stt: true,
|
|
||||||
tts: true,
|
|
||||||
call: true,
|
|
||||||
multiple_models: true,
|
|
||||||
temporary: true,
|
|
||||||
temporary_enforced: false
|
|
||||||
},
|
|
||||||
features: {
|
|
||||||
api_keys: false,
|
|
||||||
notes: true,
|
|
||||||
channels: true,
|
|
||||||
folders: true,
|
|
||||||
direct_tool_servers: false,
|
|
||||||
web_search: true,
|
|
||||||
image_generation: true,
|
|
||||||
code_interpreter: true
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
interface: true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export let permissions = {};
|
export let permissions = {};
|
||||||
export let defaultPermissions = {};
|
export let defaultPermissions = {};
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
export const DEFAULT_PERMISSIONS = {
|
||||||
|
workspace: {
|
||||||
|
models: false,
|
||||||
|
knowledge: false,
|
||||||
|
prompts: false,
|
||||||
|
tools: false,
|
||||||
|
models_import: false,
|
||||||
|
models_export: false,
|
||||||
|
prompts_import: false,
|
||||||
|
prompts_export: false,
|
||||||
|
tools_import: false,
|
||||||
|
tools_export: false
|
||||||
|
},
|
||||||
|
sharing: {
|
||||||
|
models: false,
|
||||||
|
public_models: false,
|
||||||
|
knowledge: false,
|
||||||
|
public_knowledge: false,
|
||||||
|
prompts: false,
|
||||||
|
public_prompts: false,
|
||||||
|
tools: false,
|
||||||
|
public_tools: false,
|
||||||
|
notes: false,
|
||||||
|
public_notes: false
|
||||||
|
},
|
||||||
|
chat: {
|
||||||
|
controls: true,
|
||||||
|
valves: true,
|
||||||
|
system_prompt: true,
|
||||||
|
params: true,
|
||||||
|
file_upload: true,
|
||||||
|
delete: true,
|
||||||
|
delete_message: true,
|
||||||
|
continue_response: true,
|
||||||
|
regenerate_response: true,
|
||||||
|
rate_response: true,
|
||||||
|
edit: true,
|
||||||
|
share: true,
|
||||||
|
export: true,
|
||||||
|
stt: true,
|
||||||
|
tts: true,
|
||||||
|
call: true,
|
||||||
|
multiple_models: true,
|
||||||
|
temporary: true,
|
||||||
|
temporary_enforced: false
|
||||||
|
},
|
||||||
|
features: {
|
||||||
|
api_keys: false,
|
||||||
|
notes: true,
|
||||||
|
channels: true,
|
||||||
|
folders: true,
|
||||||
|
direct_tool_servers: false,
|
||||||
|
web_search: true,
|
||||||
|
image_generation: true,
|
||||||
|
code_interpreter: true
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
interface: true
|
||||||
|
}
|
||||||
|
} as const;
|
||||||
Reference in New Issue
Block a user