From 64d5f762dc74cc66c39f99880b22a7e1d610c0a4 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Tue, 15 Sep 2026 13:13:07 +0200 Subject: [PATCH] test(datatables): run the tenant matcher test on the enterprise edition The matcher it covers is enterprise code now, so without the enterprise edition the test hit the stub and failed the default windmill-common run. It runs with private and enterprise, and a counterpart without them asserts that no tenant list covers anyone, the wildcard and a workspace admin included. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01BjfMkJyKzodxkobqGZ6Lqb --- backend/windmill-common/src/workspaces.rs | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/windmill-common/src/workspaces.rs b/backend/windmill-common/src/workspaces.rs index 41cf2b728f..e8974da0e8 100644 --- a/backend/windmill-common/src/workspaces.rs +++ b/backend/windmill-common/src/workspaces.rs @@ -3152,6 +3152,7 @@ mod tests { DataTableRoleTenants { tenants: list.iter().map(|t| t.to_string()).collect() } } + #[cfg(all(feature = "private", feature = "enterprise"))] #[test] fn a_tenant_list_covers_users_groups_folders_and_the_wildcard() { let groups = vec!["analysts".to_string()]; @@ -3189,6 +3190,29 @@ mod tests { assert!(can_use_datatable_role(&tenants(&[]), &admin)); } + #[cfg(not(all(feature = "private", feature = "enterprise")))] + #[test] + fn without_the_enterprise_edition_no_tenant_list_covers_anyone() { + let groups = vec![]; + let folders = vec![]; + let scopes = None; + let token_prefix = None; + let is_admin = true; + let is_operator = false; + let admin = crate::db::AuthedRef { + email: "alice@windmill.dev", + username: "alice", + is_admin: &is_admin, + is_operator: &is_operator, + groups: &groups, + folders: &folders, + scopes: &scopes, + token_prefix: &token_prefix, + }; + assert!(!can_use_datatable_role(&tenants(&["*"]), &admin)); + assert!(!can_use_datatable_role(&tenants(&["u/alice"]), &admin)); + } + #[test] fn a_datatable_ref_splits_off_its_role() { assert_eq!(parse_datatable_ref("sales").unwrap(), ("sales", None));