X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/a886877017be6744b38d84d52503d21892704139..017ab19b42969ed662d11291d399294c8f231a4e:/src/models/group.ts diff --git a/src/models/group.ts b/src/models/group.ts index d8efae26..0932b3c9 100644 --- a/src/models/group.ts +++ b/src/models/group.ts @@ -2,20 +2,56 @@ // // 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 { - kind: ResourceKind.Group; +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; + ensure_unique_name: boolean; + canWrite: boolean; + canManage: boolean; } export enum GroupClass { - Project = "project" -} \ No newline at end of file + 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]); +}; + +export const selectedFieldsOfGroup = [ + "uuid", + "name", + "group_class", + "description", + "properties", + "can_write", + "can_manage", + "trash_at", + "delete_at", + "is_trashed", + "frozen_by_uuid" +];