mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
auto-remove stale user/team roles
This commit is contained in:
1 parent
4f6919505c
commit
d36135f5b7
2 files changed
+17
-2
No files matched your search
@@ -139,7 +139,7 @@
|
|||||||
{#each [...$groups] as [role, permission] (role)}
|
{#each [...$groups] as [role, permission] (role)}
|
||||||
<Table.Row.Base {root}>
|
<Table.Row.Base {root}>
|
||||||
<Table.Cell column="role" {root}>
|
<Table.Cell column="role" {root}>
|
||||||
<Row {role} />
|
<Row {role} on:notFound={() => deleteRole(role)} />
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
<Table.Cell column="create" {root}>
|
<Table.Cell column="create" {root}>
|
||||||
<Selector.Checkbox
|
<Selector.Checkbox
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { type ComponentProps, type Snippet } from 'svelte';
|
import { type ComponentProps, type Snippet, createEventDispatcher, onMount } from 'svelte';
|
||||||
import { sdk } from '$lib/stores/sdk';
|
import { sdk } from '$lib/stores/sdk';
|
||||||
import type { Models } from '@appwrite.io/console';
|
import type { Models } from '@appwrite.io/console';
|
||||||
import { AvatarInitials } from '../';
|
import { AvatarInitials } from '../';
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
let { role, placement = 'bottom-start', children }: Props = $props();
|
let { role, placement = 'bottom-start', children }: Props = $props();
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher<{ notFound: string }>();
|
||||||
|
|
||||||
type ParsedPermission = {
|
type ParsedPermission = {
|
||||||
type: 'user' | 'team' | 'other';
|
type: 'user' | 'team' | 'other';
|
||||||
id: string;
|
id: string;
|
||||||
@@ -111,6 +113,19 @@
|
|||||||
return fetchPromise;
|
return fetchPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function verifyExistence() {
|
||||||
|
try {
|
||||||
|
const data = await getData(role);
|
||||||
|
if (data?.notFound) {
|
||||||
|
dispatch('notFound', role);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
verifyExistence();
|
||||||
|
});
|
||||||
|
|
||||||
let isMouseOverTooltip = $state(false);
|
let isMouseOverTooltip = $state(false);
|
||||||
function hidePopover(hideTooltip: () => void, timeout = true) {
|
function hidePopover(hideTooltip: () => void, timeout = true) {
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
|
|||||||
Reference in new issue
Block a user