X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1feb5aaffe6fee4a9c8c8c64877f1da6f3490e06..6e335a900ab99ddc7b7288e00d20a54f6c75ec8f:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index 5e8d7a1e0b..3f3656ccd5 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,20 +2,37 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Resource, ResourceKind } from "./resource"; +import { + ResourceKind, + ResourceWithProperties, + RESOURCE_UUID_REGEX, + ResourceObjectType, + TrashableResource +} from "./resource"; -export interface GroupResource extends Resource { +export interface GroupResource extends TrashableResource, ResourceWithProperties { kind: ResourceKind.GROUP; name: string; groupClass: GroupClass | null; description: string; - properties: string; - writeableBy: string[]; - trashAt: string; - deleteAt: string; - isTrashed: boolean; + writableBy: string[]; + ensure_unique_name: boolean; } export enum GroupClass { - PROJECT = "project" -} \ No newline at end of file + 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]); +};