18123: Disable controls related to group for built in groups.
[arvados.git] / src / models / group.ts
index e2d0367a5e40fab7fef6fc7e98058c9e3840ee89..a0c22212b794e72c6c2ce02e17c06f1c59ebacb9 100644 (file)
@@ -2,17 +2,32 @@
 //
 // 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;
     name: string;
     groupClass: GroupClass | null;
     description: string;
-    properties: string;
-    writeableBy: string[];
+    properties: any;
+    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]);
+};