mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
fix: auto-invite all instead of by domain
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO workspace_invite\n (workspace_id, email, is_admin, operator)\n SELECT $1::text, email, false, $3 FROM password WHERE $2::text = '*' OR email LIKE CONCAT('%', $2::text) AND NOT EXISTS (\n SELECT 1 FROM usr WHERE workspace_id = $1::text AND email = password.email\n )\n ON CONFLICT DO NOTHING",
|
||||
"query": "INSERT INTO workspace_invite\n (workspace_id, email, is_admin, operator)\n SELECT $1::text, email, false, $3 FROM password WHERE ($2::text = '*' OR email LIKE CONCAT('%', $2::text)) AND NOT EXISTS (\n SELECT 1 FROM usr WHERE workspace_id = $1::text AND email = password.email\n )\n ON CONFLICT DO NOTHING",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
@@ -12,5 +12,5 @@
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "9739c91f85f36367cec44b12c921e2917afbcb249dbf52c82f06c943f0e1185d"
|
||||
"hash": "0360207b5fb2a7f877c2608566454f40f7cbbcd20bcb84e5968ac3e21b6ea0f6"
|
||||
}
|
||||
@@ -1349,6 +1349,8 @@ paths:
|
||||
properties:
|
||||
operator:
|
||||
type: boolean
|
||||
invite_all:
|
||||
type: boolean
|
||||
|
||||
responses:
|
||||
"200":
|
||||
@@ -6296,7 +6298,9 @@ paths:
|
||||
|
||||
/w/{workspace}/job_helpers/duckdb_connection_settings:
|
||||
post:
|
||||
summary: Converts an S3 resource to the set of instructions necessary to connect DuckDB to an S3 bucket
|
||||
summary:
|
||||
Converts an S3 resource to the set of instructions necessary to connect
|
||||
DuckDB to an S3 bucket
|
||||
operationId: duckdbConnectionSettings
|
||||
tags:
|
||||
- helpers
|
||||
|
||||
@@ -748,13 +748,17 @@ async fn edit_auto_invite(
|
||||
// ));
|
||||
// }
|
||||
|
||||
if ea.invite_all.is_some_and(|x| x) && *CLOUD_HOSTED {
|
||||
let domain = if ea.invite_all.is_some_and(|x| x) {
|
||||
if *CLOUD_HOSTED {
|
||||
return Err(Error::BadRequest(
|
||||
"invite_all is only available locally".to_string(),
|
||||
));
|
||||
|
||||
}
|
||||
let domain = email.split('@').last().unwrap();
|
||||
} else {
|
||||
"*"
|
||||
}
|
||||
} else {
|
||||
email.split('@').last().unwrap()
|
||||
};
|
||||
|
||||
let mut tx = db.begin().await?;
|
||||
|
||||
@@ -778,7 +782,7 @@ async fn edit_auto_invite(
|
||||
sqlx::query!(
|
||||
"INSERT INTO workspace_invite
|
||||
(workspace_id, email, is_admin, operator)
|
||||
SELECT $1::text, email, false, $3 FROM password WHERE $2::text = '*' OR email LIKE CONCAT('%', $2::text) AND NOT EXISTS (
|
||||
SELECT $1::text, email, false, $3 FROM password WHERE ($2::text = '*' OR email LIKE CONCAT('%', $2::text)) AND NOT EXISTS (
|
||||
SELECT 1 FROM usr WHERE workspace_id = $1::text AND email = password.email
|
||||
)
|
||||
ON CONFLICT DO NOTHING",
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
let websockets: WebSocket[] = []
|
||||
let languageClients: MonacoLanguageClient[] = []
|
||||
let websocketInterval: NodeJS.Timer | undefined
|
||||
let websocketInterval: NodeJS.Timeout | undefined
|
||||
let lastWsAttempt: Date = new Date()
|
||||
let nbWsAttempt = 0
|
||||
let disposeMethod: () => void | undefined
|
||||
|
||||
@@ -160,14 +160,16 @@
|
||||
/>
|
||||
|
||||
{#if isStaticTemplate(inputCat)}
|
||||
<span
|
||||
class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded ml-2 {propertyType ==
|
||||
'static' && arg.type === 'javascript'
|
||||
? 'visible'
|
||||
: 'invisible'}"
|
||||
>
|
||||
{'${...}'}
|
||||
</span>
|
||||
<div>
|
||||
<span
|
||||
class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 !py-0.5 rounded ml-2 {propertyType ==
|
||||
'static' && arg.type === 'javascript'
|
||||
? 'visible'
|
||||
: 'invisible'}"
|
||||
>
|
||||
{'${...}'}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if !noDynamicToggle}
|
||||
|
||||
@@ -376,7 +376,7 @@
|
||||
type="text"
|
||||
placeholder={setting.placeholder}
|
||||
class={hasError
|
||||
? 'border !border-red-700 !border-opacity-30 !focus:border-red-700 !focus:border-opacity-30 !bg-red-100'
|
||||
? 'border !border-red-700 !border-opacity-30 !focus:border-red-700 !focus:border-opacity-30'
|
||||
: ''}
|
||||
bind:value={values[setting.key]}
|
||||
/>
|
||||
@@ -450,7 +450,7 @@
|
||||
|
||||
{#if hasError}
|
||||
<span class="text-red-500 text-xs">
|
||||
Base url must start with http:// or https:// and must not end with a
|
||||
Base url must start with http:// or https:// and must NOT end with a
|
||||
trailing slash.
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
@@ -32,7 +32,7 @@ export const settings: Record<string, Setting[]> = {
|
||||
placeholder: 'https://windmill.com',
|
||||
storage: 'setting',
|
||||
isValid: (value: string | undefined) =>
|
||||
value ? value?.startsWith('http') && !value?.endsWith('/') : true
|
||||
value ? value?.startsWith('http') && value.includes('://') && !value?.endsWith('/') : true
|
||||
},
|
||||
{
|
||||
label: 'Request Size Limit In MB',
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import Cell from '../table/Cell.svelte'
|
||||
import Row from '../table/Row.svelte'
|
||||
import ConfirmationModal from '../common/confirmationModal/ConfirmationModal.svelte'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
|
||||
let users: User[] | undefined = undefined
|
||||
let invites: WorkspaceInvite[] = []
|
||||
@@ -331,18 +332,20 @@
|
||||
primary={false}
|
||||
/>
|
||||
<div class="flex gap-2">
|
||||
{#if auto_invite_domain != domain}
|
||||
{#if auto_invite_domain != domain && auto_invite_domain != '*'}
|
||||
<div>
|
||||
<Button
|
||||
disabled={!allowedAutoDomain}
|
||||
on:click={async () => {
|
||||
await WorkspaceService.editAutoInvite({
|
||||
workspace: $workspaceStore ?? '',
|
||||
requestBody: { operator: false }
|
||||
requestBody: { operator: false, invite_all: !isCloudHosted() }
|
||||
})
|
||||
loadSettings()
|
||||
listInvites()
|
||||
}}>Set auto-invite to {domain}</Button
|
||||
}}
|
||||
>{#if isCloudHosted()}Auto-invite any users from {domain}{:else}Auto-invite anyone joining
|
||||
the instance{/if}</Button
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -375,7 +378,11 @@
|
||||
listInvites()
|
||||
}}
|
||||
>
|
||||
Unset auto-invite from {auto_invite_domain} domain
|
||||
{#if isCloudHosted()}
|
||||
Unset auto-invite from {auto_invite_domain} domain
|
||||
{:else}
|
||||
Unset auto-invite anyone joining the instance
|
||||
{/if}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import TestOpenaiKey from '$lib/components/copilot/TestOpenaiKey.svelte'
|
||||
import { switchWorkspace } from '$lib/storeUtils'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
|
||||
const rd = $page.url.searchParams.get('rd')
|
||||
|
||||
@@ -55,7 +56,7 @@
|
||||
if (auto_invite) {
|
||||
await WorkspaceService.editAutoInvite({
|
||||
workspace: id,
|
||||
requestBody: { operator: operatorOnly }
|
||||
requestBody: { operator: operatorOnly, invite_all: !isCloudHosted() }
|
||||
})
|
||||
}
|
||||
if (openAiKey != '') {
|
||||
@@ -180,13 +181,17 @@
|
||||
<Toggle
|
||||
disabled={!isDomainAllowed}
|
||||
bind:checked={auto_invite}
|
||||
options={{ right: `Auto invite users with the same email address domain (${domain})` }}
|
||||
options={{
|
||||
right: isCloudHosted()
|
||||
? `Auto-invite users with the same email address domain (${domain})`
|
||||
: `Auto-invite anyone joining the instance`
|
||||
}}
|
||||
/>
|
||||
<div class="flex items-center gap-1">
|
||||
<Toggle
|
||||
disabled={!auto_invite}
|
||||
bind:checked={operatorOnly}
|
||||
options={{ right: `Auto invite users as operators` }}
|
||||
options={{ right: `Auto-invite users as operators` }}
|
||||
/>
|
||||
<Tooltip
|
||||
>An operator can only execute and view scripts/flows/apps from your workspace, and only those
|
||||
|
||||
@@ -285,9 +285,6 @@
|
||||
<div class="flex gap-2 items-center my-1"> Premium Plans </div>
|
||||
</Tab>
|
||||
{/if}
|
||||
<Tab size="xs" value="export_delete">
|
||||
<div class="flex gap-2 items-center my-1"> Delete Workspace </div>
|
||||
</Tab>
|
||||
{#if WORKSPACE_SHOW_WEBHOOK_CLI_SYNC}
|
||||
<Tab size="xs" value="webhook">
|
||||
<div class="flex gap-2 items-center my-1">Webhook</div>
|
||||
@@ -299,6 +296,9 @@
|
||||
<Tab size="xs" value="openai">
|
||||
<div class="flex gap-2 items-center my-1">Windmill AI</div>
|
||||
</Tab>
|
||||
<Tab size="xs" value="export_delete">
|
||||
<div class="flex gap-2 items-center my-1"> Delete Workspace </div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</div>
|
||||
{#if tab == 'users'}
|
||||
|
||||
Reference in New Issue
Block a user