mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00

Co-authored-by: Archer <545436317@qq.com> Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
31 lines
633 B
TypeScript
31 lines
633 B
TypeScript
import { TeamMemberRoleEnum } from '../user/team/constant';
|
|
import { PermissionTypeEnum } from './constant';
|
|
import { Permission } from './controller';
|
|
|
|
/* team public source, or owner source in team */
|
|
export function mongoRPermission({
|
|
teamId,
|
|
tmbId,
|
|
permission
|
|
}: {
|
|
teamId: string;
|
|
tmbId: string;
|
|
permission: Permission;
|
|
}) {
|
|
if (permission.isOwner) {
|
|
return {
|
|
teamId
|
|
};
|
|
}
|
|
return {
|
|
teamId,
|
|
$or: [{ permission: PermissionTypeEnum.public }, { tmbId }]
|
|
};
|
|
}
|
|
export function mongoOwnerPermission({ teamId, tmbId }: { teamId: string; tmbId: string }) {
|
|
return {
|
|
teamId,
|
|
tmbId
|
|
};
|
|
}
|