mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
* feat: configurable workspace roles with per-workspace overrides Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: close role review gaps in pickers, declarative sync and removal Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: keep resolve_role_name doc on its function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: validate overrides on instance role changes and bill admins fully Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: allow pipeline drafts and keep role checks on one connection Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: list data pipelines in operator_can_draft Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: expect a 403 role refusal when an operator resolves jobs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: require a valid license for custom workspace roles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: freeze workspace roles when the license lapses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: pin the ee companion for workspace roles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: broadcast role override changes from the write path, not a trigger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: update ee-repo-ref to b5294d38db082bdd104d5358a47695390694c05d This commit updates the EE repository reference after PR #891 was merged in windmill-ee-private. Previous ee-repo-ref: 688e00c5982865b14098f530d54280e2311994c0 New ee-repo-ref: b5294d38db082bdd104d5358a47695390694c05d Automated by sync-ee-ref workflow. * feat: add workspace roles settings UI and role pickers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: show the server's reason when a settings save fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: default role pickers to a defined role and confirm resets of unknown capabilities Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: treat null role capabilities as unset and key role drafts by map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: gate the frontend on workspace role capabilities Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: gate deploys, bulk actions and chat composition per role kind Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: treat a superadmin as full in deploy permission checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: leave page visibility out of isRestricted, as the server does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: let a member discard their own draft without the authoring right Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: show custom roles as inactive without a valid license Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep the user store import on the agent page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: show custom roles as frozen without a valid license Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: reorder instance roles with a drag handle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: let an admin row that kept the operator flag hold full rights everywhere Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: treat superadmin members as admins and return role names from get user Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: move the instance role label into the expanded panel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
98 lines
3.5 KiB
Svelte
98 lines
3.5 KiB
Svelte
<script lang="ts">
|
|
import type { ProtectionRuleset } from '$lib/gen'
|
|
import { roleCapabilities, type UserExt } from '$lib/stores'
|
|
import { getUserExt } from '$lib/user'
|
|
import {
|
|
fetchProtectionRulesForWorkspace,
|
|
isRuleActiveInRulesets,
|
|
canUserBypassRuleKindInRulesets,
|
|
getActiveRulesetsForKindInRulesets
|
|
} from '$lib/workspaceProtectionRules.svelte'
|
|
import { Alert } from './common'
|
|
import { resource } from 'runed'
|
|
|
|
let {
|
|
parentWorkspaceId,
|
|
displayName,
|
|
onUpdateCanDeploy = (value) => {}
|
|
}: {
|
|
parentWorkspaceId: string
|
|
/** How to name the target in the message, when its id is not what a reader would recognize
|
|
* — a remote deploy target is addressed through a proxy path. */
|
|
displayName?: string
|
|
onUpdateCanDeploy?: (value: boolean) => void
|
|
} = $props()
|
|
|
|
let overrideChecked = $state(false)
|
|
|
|
// Fetch the parent's rules and the user's identity in the parent together. Both must come from the
|
|
// parent: bypass is judged with is_admin/groups in the PARENT (per-workspace), not the active/fork
|
|
// workspace's `$userStore`; getUserExt returns undefined for a non-member, treated as no bypass.
|
|
const parentDataResource = resource(
|
|
() => parentWorkspaceId,
|
|
async (wsId) => {
|
|
if (!wsId) return { rules: [] as ProtectionRuleset[], user: undefined as UserExt | undefined }
|
|
const [rules, user] = await Promise.all([
|
|
fetchProtectionRulesForWorkspace(wsId),
|
|
getUserExt(wsId)
|
|
])
|
|
return { rules, user }
|
|
}
|
|
)
|
|
let parentRulesets = $derived(parentDataResource.current?.rules ?? [])
|
|
let parentUserInfo = $derived(parentDataResource.current?.user)
|
|
|
|
let activeDeployRulesets = $derived(
|
|
getActiveRulesetsForKindInRulesets(parentRulesets, 'DisableDirectDeployment')
|
|
)
|
|
|
|
let canBypass = $derived(
|
|
canUserBypassRuleKindInRulesets(parentRulesets, 'DisableDirectDeployment', parentUserInfo)
|
|
)
|
|
|
|
// Block deploy until the parent's rules/identity have loaded: while loading `parentRulesets` is
|
|
// empty, which would otherwise read as "no lock" and briefly enable deploy before the real
|
|
// lock/bypass check resolves.
|
|
let canDeploy = $derived(
|
|
!parentDataResource.loading &&
|
|
(!isRuleActiveInRulesets(parentRulesets, 'DisableDirectDeployment') ||
|
|
(canBypass && overrideChecked))
|
|
)
|
|
|
|
// Reset override when parent workspace changes
|
|
$effect(() => {
|
|
parentWorkspaceId
|
|
overrideChecked = false
|
|
})
|
|
|
|
// Communicate deployment status to parent
|
|
$effect(() => {
|
|
onUpdateCanDeploy(canDeploy)
|
|
})
|
|
</script>
|
|
|
|
{#if ($roleCapabilities.code || $roleCapabilities.flows !== 'none' || $roleCapabilities.apps !== 'none') && activeDeployRulesets.length > 0}
|
|
<!-- Named for the deploy destination, not the lineage: the merge UI also points
|
|
this at a target outside the fork lineage. -->
|
|
<Alert type="info" title="Target workspace protection active" class="my-2">
|
|
<div class="flex flex-col gap-2">
|
|
<p>
|
|
The workspace {displayName ?? parentWorkspaceId} has a protection rule{activeDeployRulesets.length >
|
|
1
|
|
? 's'
|
|
: ''}
|
|
<b>{activeDeployRulesets.map((r) => r.name).join(', ')}</b>
|
|
that restrict{activeDeployRulesets.length > 1 ? '' : 's'} direct deployments. You need to merge
|
|
changes through the synced git repo with Git Sync, or by asking a user with the rights to bypass
|
|
this rule.
|
|
</p>
|
|
{#if canBypass}
|
|
<label class="flex items-center gap-2 cursor-pointer">
|
|
<input class="rounded max-w-4" type="checkbox" bind:checked={overrideChecked} />
|
|
<span class="text-xs">Bypass restriction and deploy anyway</span>
|
|
</label>
|
|
{/if}
|
|
</div>
|
|
</Alert>
|
|
{/if}
|