X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b0573b45f19c656ac07901004a3686ef10d402a5..034bf8ad6df6c47d3c392ae8233c8d08dc6b4609:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index dae516bddb..f6a72c538f 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,17 +2,41 @@ // // 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 enum BuiltinGroups { + ALL = 'fffffffffffffff', + ANON = 'anonymouspublic', + SYSTEM = '000000000000000', +} + +export const getBuiltinGroupUuid = (cluster: string, groupName: BuiltinGroups): string => { + return cluster ? `${cluster}-${ResourceObjectType.GROUP}-${groupName}` : ""; +}; + +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 && Object.values(BuiltinGroups).includes(parts[2]); +};