This change introduces a visual warning in the group settings page. The warning appears when an admin attempts to disable a permission for a group that is already enabled in the default 'user' group. This is necessary because permissions are additive, and disabling a permission in a specific group will not revoke it if it's enabled in the default group. To achieve this, the following changes were made: - A new `PermissionSwitch.svelte` component was created to encapsulate the permission switch and its warning logic, avoiding redundant code. - The `Groups.svelte` component was updated to correctly fetch the default user group's permissions. - The `Permissions.svelte` component was refactored to use the new `PermissionSwitch.svelte` component, making the code cleaner and more maintainable.
26 lines
652 B
Svelte
26 lines
652 B
Svelte
<script lang="ts">
|
|
export let size: 'sm' | 'md' | 'lg' | null = null;
|
|
export let className: string = '';
|
|
export let strokeWidth = '1.5';
|
|
</script>
|
|
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke-width={strokeWidth}
|
|
stroke="currentColor"
|
|
class="{size === 'sm'
|
|
? 'w-5 h-5'
|
|
: size === 'md'
|
|
? 'w-6 h-6'
|
|
: size === 'lg'
|
|
? 'w-7 h-7'
|
|
: ''} {className}"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
/>
|
|
</svg> |