{ if (o) { formError = ''; formErrors = {}; focusFirstInput(); } }}> {#if isEditing} Edit role {:else if isCopying} Copy role {:else} Create role {/if} {#if isEditing} Update role permissions {:else if isCopying} Create a new role based on "{copyFrom?.name}" {:else} Define a new role with specific permissions {/if} {#if formError} {formError} {/if}
formErrors.name = undefined} /> {#if formErrors.name}

{formErrors.name}

{/if}
System permissions (always global)
{#each Object.entries(systemPermissions) as [category, permissions]} {@const IconComponent = categoryIcons[category]}
{category}
|
{#each permissions as permission} {@const PermIcon = permissionIcons[permission.key]} {/each}
{/each}
Environment permissions
{#if environments.length > 0}
All environments (incl. new)
{/if}
{#if environments.length > 0} {#if !formAllEnvironments}
{#each environments as env} {@const EnvIcon = getIconComponent(env.icon || 'globe')} {/each}
{#if formEnvironmentIds.length === 0}

Select at least one environment for these permissions to be effective.

{/if} {:else}

Permissions apply to all environments, including future ones.

{/if} {:else}

Permissions apply to all environments.

{/if}
{#each Object.entries(environmentPermissions) as [category, permissions]} {@const IconComponent = categoryIcons[category]}
{category}
|
{#each permissions as permission} {@const PermIcon = permissionIcons[permission.key]} {/each}
{/each}