organizationRoles.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import type {Organization, OrgRole} from 'sentry/types/organization';
  2. export const ORG_ROLES: OrgRole[] = [
  3. {
  4. id: 'billing',
  5. name: 'Billing',
  6. isAllowed: true,
  7. desc: 'Can manage payment and compliance details.',
  8. minimumTeamRole: 'contributor',
  9. isTeamRolesAllowed: false,
  10. },
  11. {
  12. id: 'member',
  13. name: 'Member',
  14. isAllowed: true,
  15. desc: 'Members can view and act on events, as well as view most other data within the organization.',
  16. minimumTeamRole: 'contributor',
  17. isTeamRolesAllowed: true,
  18. },
  19. {
  20. id: 'manager',
  21. name: 'Manager',
  22. isAllowed: true,
  23. desc: 'Gains admin access on all teams as well as the ability to add and remove members.',
  24. minimumTeamRole: 'admin',
  25. isTeamRolesAllowed: true,
  26. },
  27. {
  28. id: 'owner',
  29. name: 'Owner',
  30. isAllowed: true,
  31. desc: 'Unrestricted access to the organization, its data, and its settings. Can add, modify, and delete projects and members, as well as make billing and plan changes.',
  32. minimumTeamRole: 'admin',
  33. isTeamRolesAllowed: true,
  34. },
  35. ];
  36. export function getOrgRoles(organization: Organization): OrgRole[] {
  37. if (organization.features.includes('team-roles')) {
  38. return ORG_ROLES;
  39. }
  40. const adminRole: OrgRole = {
  41. id: 'admin',
  42. name: 'Admin',
  43. isAllowed: true,
  44. desc: "Admin privileges on any teams of which they're a member. They can create new teams and projects, as well as remove teams and projects on which they already hold membership (or all teams, if open membership is enabled). Additionally, they can manage memberships of teams that they are members of. They cannot invite members to the organization.",
  45. minimumTeamRole: 'admin',
  46. isTeamRolesAllowed: true,
  47. };
  48. const rolesWithAdmin = [...ORG_ROLES];
  49. // insert admin role to keep roles ordered from least to most permissions
  50. rolesWithAdmin.splice(2, 0, adminRole);
  51. return rolesWithAdmin;
  52. }