mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 19:21:39 +10:00
fix: wip
This commit is contained in:
@ -1,29 +1,58 @@
|
||||
import type { MessageDescriptor } from '@lingui/core';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { TeamMemberRole } from '@prisma/client';
|
||||
import { OrganisationGroupType, TeamMemberRole } from '@prisma/client';
|
||||
|
||||
export const TEAM_URL_ROOT_REGEX = new RegExp('^/t/[^/]+/?$');
|
||||
export const TEAM_URL_REGEX = new RegExp('^/t/[^/]+');
|
||||
|
||||
export const LOWEST_TEAM_ROLE = TeamMemberRole.MEMBER;
|
||||
|
||||
export const ALLOWED_TEAM_GROUP_TYPES: OrganisationGroupType[] = [
|
||||
OrganisationGroupType.CUSTOM,
|
||||
OrganisationGroupType.INTERNAL_ORGANISATION,
|
||||
];
|
||||
|
||||
export const TEAM_INTERNAL_GROUPS: {
|
||||
teamRole: TeamMemberRole;
|
||||
type: OrganisationGroupType;
|
||||
}[] = [
|
||||
{
|
||||
teamRole: TeamMemberRole.ADMIN,
|
||||
type: OrganisationGroupType.INTERNAL_TEAM,
|
||||
},
|
||||
{
|
||||
teamRole: TeamMemberRole.MANAGER,
|
||||
type: OrganisationGroupType.INTERNAL_TEAM,
|
||||
},
|
||||
{
|
||||
teamRole: TeamMemberRole.MEMBER,
|
||||
type: OrganisationGroupType.INTERNAL_TEAM,
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const TEAM_MEMBER_ROLE_MAP: Record<keyof typeof TeamMemberRole, MessageDescriptor> = {
|
||||
ADMIN: msg`Admin`,
|
||||
MANAGER: msg`Manager`,
|
||||
MEMBER: msg`Member`,
|
||||
};
|
||||
|
||||
export const EXTENDED_TEAM_MEMBER_ROLE_MAP: Record<keyof typeof TeamMemberRole, MessageDescriptor> =
|
||||
{
|
||||
ADMIN: msg`Team Admin`,
|
||||
MANAGER: msg`Team Manager`,
|
||||
MEMBER: msg`Team Member`,
|
||||
};
|
||||
|
||||
export const TEAM_MEMBER_ROLE_PERMISSIONS_MAP = {
|
||||
/**
|
||||
* Includes permissions to:
|
||||
* - Manage team members
|
||||
* - Manage team settings, changing name, url, etc.
|
||||
*/
|
||||
DELETE_TEAM: [TeamMemberRole.ADMIN],
|
||||
MANAGE_TEAM: [TeamMemberRole.ADMIN, TeamMemberRole.MANAGER],
|
||||
MANAGE_BILLING: [TeamMemberRole.ADMIN],
|
||||
DELETE_TEAM_TRANSFER_REQUEST: [TeamMemberRole.ADMIN],
|
||||
} satisfies Record<string, TeamMemberRole[]>;
|
||||
|
||||
/**
|
||||
* A hierarchy of team member roles to determine which role has higher permission than another.
|
||||
*
|
||||
* Warning: The length of the array is used to determine the priority of the role.
|
||||
* See `getHighestTeamRoleInGroup`
|
||||
*/
|
||||
export const TEAM_MEMBER_ROLE_HIERARCHY = {
|
||||
[TeamMemberRole.ADMIN]: [TeamMemberRole.ADMIN, TeamMemberRole.MANAGER, TeamMemberRole.MEMBER],
|
||||
|
||||
Reference in New Issue
Block a user