superadmin can see all
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
type Group
|
||||
} from '$lib/gen'
|
||||
import { GroupService } from '$lib/gen'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { superadmin, userStore, workspaceStore } from '$lib/stores'
|
||||
import { sleep } from '$lib/utils'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import Required from './Required.svelte'
|
||||
@@ -198,7 +198,7 @@
|
||||
type="text"
|
||||
bind:value={meta.owner}
|
||||
placeholder={$userStore?.username ?? ''}
|
||||
disabled={!($userStore?.is_admin ?? false)}
|
||||
disabled={!($superadmin || ($userStore?.is_admin ?? false))}
|
||||
/>
|
||||
</label>
|
||||
{:else}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { userStore } from '$lib/stores'
|
||||
import { faPeopleGroup } from '@fortawesome/free-solid-svg-icons'
|
||||
import { Users } from 'svelte-lucide'
|
||||
import Badge from './common/badge/Badge.svelte'
|
||||
import Tooltip from './Tooltip.svelte'
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
ToggleButton,
|
||||
ToggleButtonGroup
|
||||
} from '$lib/components/common'
|
||||
import { canWrite, classNames, getScriptByPath, pluralize } from '$lib/utils'
|
||||
import { canWrite, classNames, pluralize } from '$lib/utils'
|
||||
import type { HubItem } from '$lib/components/flows/pickers/model'
|
||||
import ShareModal from '$lib/components/ShareModal.svelte'
|
||||
import { faCodeFork, faGlobe } from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { faDiscord, faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import MenuLink from './MenuLink.svelte'
|
||||
import { userStore } from '$lib/stores'
|
||||
import { superadmin, userStore } from '$lib/stores'
|
||||
|
||||
const mainMenuLinks = [
|
||||
{ label: 'Home', href: '/', icon: faHomeAlt },
|
||||
@@ -33,7 +33,7 @@
|
||||
label: 'Workspace',
|
||||
href: '/workspace_settings',
|
||||
icon: faCog,
|
||||
disabled: !$userStore?.is_admin
|
||||
disabled: !($userStore?.is_admin || $superadmin)
|
||||
},
|
||||
{ label: 'Workers', href: '/workers', icon: faRobot }
|
||||
]
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
{#if !isCollapsed}
|
||||
<span class={classNames('whitespace-pre truncate')}>
|
||||
{$userStore?.username ?? ($superadmin ? $superadmin : '___')}
|
||||
{#if $userStore?.is_admin}
|
||||
{#if $userStore?.is_admin || $superadmin}
|
||||
<Icon data={faCrown} scale={0.6} />
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FlowService, Script, ScriptService, type Flow, type FlowModule, type Us
|
||||
import { toast } from '@zerodevx/svelte-toast'
|
||||
import { get } from 'svelte/store'
|
||||
import type { Schema, SupportedLanguage } from './common'
|
||||
import { hubScripts, workspaceStore, type UserExt } from './stores'
|
||||
import { hubScripts, superadmin, workspaceStore, type UserExt } from './stores'
|
||||
|
||||
export function validateUsername(username: string): string {
|
||||
if (username != '' && !/^\w+$/.test(username)) {
|
||||
@@ -59,9 +59,8 @@ export function displayDate(dateString: string | undefined): string {
|
||||
if (date.toString() === 'Invalid Date') {
|
||||
return ''
|
||||
} else {
|
||||
return `${date.getFullYear()}/${
|
||||
date.getMonth() + 1
|
||||
}/${date.getDate()} at ${date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`
|
||||
return `${date.getFullYear()}/${date.getMonth() + 1
|
||||
}/${date.getDate()} at ${date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +179,7 @@ export function canWrite(
|
||||
if (!user) {
|
||||
return false
|
||||
}
|
||||
if (user.is_admin) {
|
||||
if (user.is_admin || get(superadmin)) {
|
||||
return true
|
||||
}
|
||||
let userOwner = `u/${user.username}`
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { displayDate } from '$lib/utils'
|
||||
import { goto } from '$app/navigation'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { superadmin, userStore, workspaceStore } from '$lib/stores'
|
||||
import TableCustom from '$lib/components/TableCustom.svelte'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import Icon from 'svelte-awesome'
|
||||
@@ -52,9 +52,10 @@
|
||||
}
|
||||
|
||||
async function loadUsers() {
|
||||
usernames = $userStore?.is_admin
|
||||
? await UserService.listUsernames({ workspace: $workspaceStore! })
|
||||
: [$userStore?.username ?? '']
|
||||
usernames =
|
||||
$userStore?.is_admin || $superadmin
|
||||
? await UserService.listUsernames({ workspace: $workspaceStore! })
|
||||
: [$userStore?.username ?? '']
|
||||
}
|
||||
|
||||
async function gotoUsername(username: string | undefined): Promise<void> {
|
||||
@@ -102,11 +103,11 @@
|
||||
<label>
|
||||
<select class="px-6" bind:value={username} on:change={() => gotoUsername(username)}>
|
||||
{#if usernames}
|
||||
{#if $userStore?.is_admin}
|
||||
{#if $userStore?.is_admin || $superadmin}
|
||||
<option selected>all</option>
|
||||
{/if}
|
||||
{#each usernames as e}
|
||||
{#if e == username || $userStore?.is_admin}
|
||||
{#if e == username || $userStore?.is_admin || $superadmin}
|
||||
<option>{e}</option>
|
||||
{:else}
|
||||
<option disabled>{e}</option>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import ShareModal from '$lib/components/ShareModal.svelte'
|
||||
import SharedBadge from '$lib/components/SharedBadge.svelte'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
import { userStore, workspaceStore, oauthStore } from '$lib/stores'
|
||||
import { userStore, workspaceStore, oauthStore, superadmin } from '$lib/stores'
|
||||
import SchemaEditor from '$lib/components/SchemaEditor.svelte'
|
||||
import SchemaViewer from '$lib/components/SchemaViewer.svelte'
|
||||
import Dropdown from '$lib/components/Dropdown.svelte'
|
||||
@@ -203,7 +203,7 @@
|
||||
<input id="inp" type="text" bind:value={newResourceType.name} />
|
||||
</div>
|
||||
|
||||
{#if $userStore?.is_admin}
|
||||
{#if $userStore?.is_admin || $superadmin}
|
||||
<Toggle
|
||||
bind:checked={disableCustomPrefix}
|
||||
options={{ right: 'disable c_ prefix (admin only)' }}
|
||||
@@ -500,7 +500,7 @@
|
||||
workspaces</Tooltip
|
||||
></Badge
|
||||
>
|
||||
{:else if $userStore?.is_admin}
|
||||
{:else if $userStore?.is_admin || $superadmin}
|
||||
<Button
|
||||
size="sm"
|
||||
color="red"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
faFastForward
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import DisplayResult from '$lib/components/DisplayResult.svelte'
|
||||
import { userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import { superadmin, userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import FlowStatusViewer from '$lib/components/FlowStatusViewer.svelte'
|
||||
import HighlightCode from '$lib/components/HighlightCode.svelte'
|
||||
@@ -129,7 +129,7 @@
|
||||
<svelte:fragment slot="left">
|
||||
{@const isScript = job?.job_kind === 'script'}
|
||||
{@const runsHref = `/runs/${job?.script_path}${!isScript ? '?jobKind=flow' : ''}`}
|
||||
{#if job && 'deleted' in job && !job?.deleted && ($userStore?.is_admin ?? false)}
|
||||
{#if job && 'deleted' in job && !job?.deleted && ($superadmin || ($userStore?.is_admin ?? false))}
|
||||
<Button
|
||||
disabled={not_same_workspace}
|
||||
variant="border"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import type { User } from '$lib/gen'
|
||||
import { sendUserToast, msToSec } from '$lib/utils'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
import { userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import { superadmin, userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import { faSlack } from '@fortawesome/free-brands-svg-icons'
|
||||
import TableCustom from '$lib/components/TableCustom.svelte'
|
||||
@@ -103,7 +103,7 @@
|
||||
/>
|
||||
|
||||
<CenteredPage>
|
||||
{#if $userStore?.is_admin}
|
||||
{#if $userStore?.is_admin || $superadmin}
|
||||
<PageHeader title="Workspace Settings of {$workspaceStore}" />
|
||||
|
||||
<PageHeader title="Members" primary={false} />
|
||||
|
||||
Reference in New Issue
Block a user