Merge branch '16602-wb2-acr-version' refs #16602
[arvados-workbench2.git] / src / models / object-types.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 const USER_UUID_REGEX = /.*tpzed.*/;
6 const GROUP_UUID_REGEX = /.*-j7d0g-.*/;
7
8 export enum ObjectTypes {
9     USER = "User",
10     GROUP = "Group",
11     UNKNOWN = "Unknown"
12 }
13
14 export const getUuidObjectType = (uuid: string) => {
15     switch (true) {
16         case USER_UUID_REGEX.test(uuid):
17             return ObjectTypes.USER;
18         case GROUP_UUID_REGEX.test(uuid):
19             return ObjectTypes.GROUP;
20         default:
21             return ObjectTypes.UNKNOWN;
22     }
23 };