X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f14b66751cfaf92a2bc28331d8878789d4040e8f..5e020488f67b5bc919796e0dc8b0b9f3b3ff23b0:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index dae516bd..3f3656cc 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,17 +2,37 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Resource } from "../common/api/common-resource-service"; -import { ResourceKind } from "./kinds"; +import { + ResourceKind, + ResourceWithProperties, + RESOURCE_UUID_REGEX, + ResourceObjectType, + TrashableResource +} from "./resource"; -export interface GroupResource extends Resource { - kind: ResourceKind.Group; +export interface GroupResource extends TrashableResource, ResourceWithProperties { + kind: ResourceKind.GROUP; name: string; - groupClass: string; + groupClass: GroupClass | null; description: string; - properties: string; - writeableBy: string[]; - trashAt: string; - deleteAt: string; - isTrashed: boolean; -} \ No newline at end of file + writableBy: string[]; + ensure_unique_name: boolean; +} + +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]); +};