From 79ead8f8e387dfa7166310a9164b2a889028f3d4 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 30 Sep 2023 07:50:13 +0200 Subject: [PATCH] fix worker groups for non superadmins --- backend/windmill-api/src/configs.rs | 7 +------ backend/windmill-api/src/workspaces.rs | 2 +- frontend/src/lib/components/WorkspaceGroup.svelte | 4 ++++ frontend/src/routes/(root)/(logged)/workers/+page.svelte | 6 ++++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/windmill-api/src/configs.rs b/backend/windmill-api/src/configs.rs index 000db77bf9..dcb6307304 100644 --- a/backend/windmill-api/src/configs.rs +++ b/backend/windmill-api/src/configs.rs @@ -35,12 +35,7 @@ struct Config { config: serde_json::Value, } -async fn list_worker_groups( - authed: ApiAuthed, - Extension(db): Extension, -) -> error::JsonResult> { - require_super_admin(&db, &authed.email).await?; - +async fn list_worker_groups(Extension(db): Extension) -> error::JsonResult> { let rows = sqlx::query_as!(Config, "SELECT * FROM config WHERE name LIKE 'worker__%'") .fetch_all(&db) .await?; diff --git a/backend/windmill-api/src/workspaces.rs b/backend/windmill-api/src/workspaces.rs index 7fa5a681d8..1a6f5e6d3d 100644 --- a/backend/windmill-api/src/workspaces.rs +++ b/backend/windmill-api/src/workspaces.rs @@ -866,7 +866,7 @@ async fn _check_nb_of_workspaces(db: &DB) -> Result<()> { .await?; if nb_workspaces.unwrap_or(0) >= 3 { return Err(Error::BadRequest( - "You have reached the maximum number of workspaces (3 outside of default group 'admins') without an enterprise license. Archive/delete another workspace to create a new one" + "You have reached the maximum number of workspaces (3 outside of default worskapce 'admins') without an enterprise license. Archive/delete another workspace to create a new one" .to_string(), )); } diff --git a/frontend/src/lib/components/WorkspaceGroup.svelte b/frontend/src/lib/components/WorkspaceGroup.svelte index 558d539202..4d5f9bfb78 100644 --- a/frontend/src/lib/components/WorkspaceGroup.svelte +++ b/frontend/src/lib/components/WorkspaceGroup.svelte @@ -241,5 +241,9 @@ delete config {/if} + {:else if config} + config {JSON.stringify(config, null, 4)} {/if} diff --git a/frontend/src/routes/(root)/(logged)/workers/+page.svelte b/frontend/src/routes/(root)/(logged)/workers/+page.svelte index e5dee73756..d33bcc22d5 100644 --- a/frontend/src/routes/(root)/(logged)/workers/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workers/+page.svelte @@ -71,8 +71,10 @@ secondInterval = setInterval(() => { timeSinceLastPing += 1 }, 1000) - loadGlobalCache() - loadCustomTags() + if ($superadmin) { + loadGlobalCache() + loadCustomTags() + } }) async function loadGlobalCache() {