X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/825ea4fce4ba3568f6105c17e83f4769a9323759..6e335a900ab99ddc7b7288e00d20a54f6c75ec8f:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index 365e9cce..3f3656cc 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,14 +2,19 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ResourceKind, TrashableResource } from "./resource"; +import { + ResourceKind, + ResourceWithProperties, + RESOURCE_UUID_REGEX, + ResourceObjectType, + TrashableResource +} from "./resource"; -export interface GroupResource extends TrashableResource { +export interface GroupResource extends TrashableResource, ResourceWithProperties { kind: ResourceKind.GROUP; name: string; groupClass: GroupClass | null; description: string; - properties: any; writableBy: string[]; ensure_unique_name: boolean; } @@ -17,4 +22,17 @@ export interface GroupResource extends TrashableResource { export enum GroupClass { PROJECT = 'project', FILTER = 'filter', + ROLE = 'role', } + +export const BUILTIN_GROUP_IDS = [ + 'fffffffffffffff', + 'anonymouspublic', + '000000000000000', +] + +export const isBuiltinGroup = (uuid: string) => { + const match = RESOURCE_UUID_REGEX.exec(uuid); + const parts = match ? match[0].split('-') : []; + return parts.length === 3 && parts[1] === ResourceObjectType.GROUP && BUILTIN_GROUP_IDS.includes(parts[2]); +};