limit number of groups to 5 in ce

This commit is contained in:
Ruben Fiszel
2023-08-28 02:23:29 +02:00
parent c86773ba6f
commit c51eebd0e1
3 changed files with 17 additions and 2 deletions
+13
View File
@@ -210,6 +210,19 @@ async fn create_group(
check_name_conflict(&mut tx, &w_id, &ng.name).await?;
#[cfg(not(feature = "enterprise"))]
{
let nb_groups = sqlx::query_scalar!("SELECT COUNT(*) FROM group_ WHERE name != 'all'",)
.fetch_one(&mut *tx)
.await?;
if nb_groups.unwrap_or(0) >= 5 {
return Err(Error::BadRequest(
"You have reached the maximum number of groups without an enterprise license"
.to_string(),
));
}
}
sqlx::query!(
"INSERT INTO group_ (workspace_id, name, summary, extra_perms) VALUES ($1, $2, $3, $4)",
w_id,
@@ -174,7 +174,9 @@
on:blur
class={twMerge(
buttonClass,
disabled ? '!bg-surface-disabled !text-disabled !cursor-not-allowed' : ''
disabled
? '!bg-surface-disabled !text-tertiary border border-disabled !cursor-not-allowed'
: ''
)}
{id}
tabindex={disabled ? -1 : 0}
@@ -377,7 +377,7 @@
<div class="flex flex-col gap-1 md:flex-row w-full p-4">
<div class="flex gap-2 grow mb-2">
<div class="flex gap-1 relative max-w-36 min-w-[50px]">
<div class="text-xs absolute -top-4 truncate">Jobs Waiting for Worker</div>
<div class="text-xs absolute -top-4 truncate">Jobs waiting for a worker</div>
<div class="mt-1">{queue_count ? ($queue_count ?? 0).toFixed(0) : '...'}</div>
</div>
<div class="flex"