1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
8 ResourceWithProperties,
14 export interface GroupResource extends TrashableResource, ResourceWithProperties {
15 kind: ResourceKind.GROUP;
17 groupClass: GroupClass | null;
19 ensure_unique_name: boolean;
22 // Optional local-only field, undefined for not loaded, null for failed to load
23 memberCount?: number | null;
26 export enum GroupClass {
32 export enum BuiltinGroups {
33 ALL = 'fffffffffffffff',
34 ANON = 'anonymouspublic',
35 SYSTEM = '000000000000000',
38 export const getBuiltinGroupUuid = (cluster: string, groupName: BuiltinGroups): string => {
39 return cluster ? `${cluster}-${ResourceObjectType.GROUP}-${groupName}` : "";
42 export const isBuiltinGroup = (uuid: string) => {
43 const match = RESOURCE_UUID_REGEX.exec(uuid);
44 const parts = match ? match[0].split('-') : [];
45 return parts.length === 3 && parts[1] === ResourceObjectType.GROUP && Object.values<string>(BuiltinGroups).includes(parts[2]);
48 export const isUserGroup = (resource: any): resource is GroupResource => {
49 return resource && resource.kind === ResourceKind.GROUP && resource.groupClass === GroupClass.ROLE;
52 export const isGroupResource = (resource: Resource): resource is GroupResource => {
53 return resource && resource.kind === ResourceKind.GROUP;
56 export const selectedFieldsOfGroup = [