File size: 952 Bytes
05c5ed5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
export const USER_ROLES = {
  ADMIN: "admin",
  EDITOR: "editor",
  USER: "user",
} as const;
export type UserRoleNames = (typeof USER_ROLES)[keyof typeof USER_ROLES];

// Default user role is "editor" which matches the current user capabilities

export const DEFAULT_USER_ROLE: UserRoleNames =
  process.env.DEFAULT_USER_ROLE &&
  Object.values(USER_ROLES).includes(
    process.env.DEFAULT_USER_ROLE as UserRoleNames,
  )
    ? (process.env.DEFAULT_USER_ROLE as UserRoleNames)
    : USER_ROLES.EDITOR;

export type UserRolesInfo = Record<
  UserRoleNames,
  {
    label: string;
    description: string;
  }
>;

export const userRolesInfo: UserRolesInfo = {
  admin: {
    label: "Admin",
    description: "Admin user can manage the app",
  },
  editor: {
    label: "Editor",
    description:
      "Default role for users who can create agents, workflows and add MCPs",
  },
  user: {
    label: "User",
    description: "Basic user role",
  },
};