mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-20 18:54:09 +00:00
Group role (#2993)
* feat: app/dataset support group (#2898) * pref: member-group (#2862) * feat: group list ordered by updateTime * fix: transfer ownership of group when deleting member * fix: i18n fix * feat: can not set member as admin/owner when user is not active * fix: GroupInfoModal hover input do not change color * fix(fe): searchinput do not scroll * feat: app collaborator with group, remove default permission * feat: dataset collaborator with group, remove default permission * chore(test): pref mock * chore: remove useless code * chore: adjust * fix: add self as collaborator when creating folder * fix(fe): folder manage menu do not show when user has write permission only * fix: dataset folder create * feat: Add code comment * Pref: app move (#2952) * perf: app schema * doc --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -1,35 +1,22 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { PermissionTypeEnum, PermissionTypeMap } from '@fastgpt/global/support/permission/constant';
|
||||
import React from 'react';
|
||||
import { PermissionTypeMap } from '@fastgpt/global/support/permission/constant';
|
||||
import { Box, StackProps, HStack } from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { PermissionValueType } from '@fastgpt/global/support/permission/type';
|
||||
import { Permission } from '@fastgpt/global/support/permission/controller';
|
||||
|
||||
const PermissionIconText = ({
|
||||
permission,
|
||||
defaultPermission,
|
||||
w = '1rem',
|
||||
fontSize = 'mini',
|
||||
iconColor = 'myGray.500',
|
||||
private: Private = false,
|
||||
...props
|
||||
}: {
|
||||
permission?: `${PermissionTypeEnum}`;
|
||||
defaultPermission?: PermissionValueType;
|
||||
private?: boolean;
|
||||
iconColor?: string;
|
||||
} & StackProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const per = useMemo(() => {
|
||||
if (permission) return permission;
|
||||
if (defaultPermission !== undefined) {
|
||||
const Per = new Permission({ per: defaultPermission });
|
||||
if (Per.hasWritePer) return PermissionTypeEnum.publicWrite;
|
||||
if (Per.hasReadPer) return PermissionTypeEnum.publicRead;
|
||||
return PermissionTypeEnum.clbPrivate;
|
||||
}
|
||||
return 'private';
|
||||
}, [defaultPermission, permission]);
|
||||
const per = Private ? 'private' : 'public';
|
||||
|
||||
return PermissionTypeMap[per] ? (
|
||||
<HStack spacing={1} fontSize={fontSize} {...props}>
|
||||
|
Reference in New Issue
Block a user