X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/1534cfafa7025c358548d9910b603b94b5984912..394ebdfd13fe40a7096f484c46a353d2537f4c9a:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index e13fbcbf..a0c22212 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ResourceKind, TrashableResource } from "./resource"; +import { ResourceKind, TrashableResource, ResourceObjectType, RESOURCE_UUID_REGEX } from "./resource"; export interface GroupResource extends TrashableResource { kind: ResourceKind.GROUP; @@ -10,9 +10,24 @@ export interface GroupResource extends TrashableResource { groupClass: GroupClass | null; description: string; properties: any; - writeableBy: string[]; + writableBy: string[]; + ensure_unique_name: boolean; } export enum GroupClass { - PROJECT = "project" + 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]); +};