Skip to content

chore: fix admin permission edition & resource move #5433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/global/common/error/code/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export enum AppErrEnum {
unExist = 'appUnExist',
unAuthApp = 'unAuthApp',
invalidOwner = 'invalidOwner',
invalidAppType = 'invalidAppType'
invalidAppType = 'invalidAppType',
canNotEditAdminPermission = 'canNotEditAdminPermission'
}
const appErrList = [
{
Expand All @@ -23,6 +24,10 @@ const appErrList = [
{
statusText: AppErrEnum.invalidAppType,
message: i18nT('common:code_error.app_error.invalid_app_type')
},
{
statusText: AppErrEnum.canNotEditAdminPermission,
message: i18nT('common:code_error.app_error.can_not_edit_admin_permission')
}
];
export default appErrList.reduce((acc, cur, index) => {
Expand Down
7 changes: 6 additions & 1 deletion packages/global/common/error/code/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export enum DatasetErrEnum {
invalidVectorModelOrQAModel = 'invalidVectorModelOrQAModel',
notSupportSync = 'notSupportSync',
sameApiCollection = 'sameApiCollection',
noApiServer = 'noApiServer'
noApiServer = 'noApiServer',
canNotEditAdminPermission = 'canNotEditAdminPermission'
}
const datasetErr = [
{
Expand Down Expand Up @@ -60,6 +61,10 @@ const datasetErr = [
{
statusText: DatasetErrEnum.invalidVectorModelOrQAModel,
message: 'core.dataset.error.invalidVectorModelOrQAModel'
},
{
statusText: DatasetErrEnum.canNotEditAdminPermission,
message: 'core.dataset.error.canNotEditAdminPermission'
}
];
export default datasetErr.reduce((acc, cur, index) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/web/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"code_error.app_error.invalid_owner": "Unauthorized Application Owner",
"code_error.app_error.not_exist": "Application Does Not Exist",
"code_error.app_error.un_auth_app": "Unauthorized to Operate This Application",
"code_error.app_error.can_not_edit_admin_permission": "Can not edit admin permission",
"code_error.chat_error.un_auth": "Unauthorized to Operate This Chat Record",
"code_error.error_code.400": "Request Failed",
"code_error.error_code.401": "No Access Permission",
Expand Down Expand Up @@ -485,6 +486,7 @@
"core.dataset.error.unCreateCollection": "Unauthorized to Operate This Data",
"core.dataset.error.unExistDataset": "The knowledge base does not exist",
"core.dataset.error.unLinkCollection": "Not a Web Link Collection",
"core.dataset.error.canNotEditAdminPermission": "You cannot edit the admin permission",
"core.dataset.externalFile": "External File Library",
"core.dataset.file": "File",
"core.dataset.folder": "Directory",
Expand Down
2 changes: 2 additions & 0 deletions packages/web/i18n/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"code_error.app_error.not_exist": "应用不存在",
"code_error.app_error.un_auth_app": "无权操作该应用",
"code_error.chat_error.un_auth": "没有权限操作此对话记录",
"code_error.app_error.can_not_edit_admin_permission": "不能编辑管理员权限",
"code_error.error_code.400": "请求失败",
"code_error.error_code.401": "无访问权限",
"code_error.error_code.403": "紧张访问",
Expand Down Expand Up @@ -485,6 +486,7 @@
"core.dataset.error.unCreateCollection": "无权操作该数据",
"core.dataset.error.unExistDataset": "知识库不存在",
"core.dataset.error.unLinkCollection": "不是网络链接集合",
"core.dataset.error.canNotEditAdminPermission": "无法修改管理员权限",
"core.dataset.externalFile": "外部文件库",
"core.dataset.file": "文件",
"core.dataset.folder": "目录",
Expand Down
2 changes: 2 additions & 0 deletions packages/web/i18n/zh-Hant/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"code_error.app_error.not_exist": "應用程式不存在",
"code_error.app_error.un_auth_app": "無權操作此應用程式",
"code_error.chat_error.un_auth": "沒有權限操作此對話記錄",
"code_error.app_error.can_not_edit_admin_permission": "不能編輯管理員權限",
"code_error.error_code.400": "請求失敗",
"code_error.error_code.401": "無存取權限",
"code_error.error_code.403": "禁止存取",
Expand Down Expand Up @@ -485,6 +486,7 @@
"core.dataset.error.unCreateCollection": "無權操作此資料",
"core.dataset.error.unExistDataset": "知識庫不存在",
"core.dataset.error.unLinkCollection": "不是網路連結集合",
"core.dataset.error.canNotEditAdminPermission": "無法修改管理員權限",
"core.dataset.externalFile": "外部檔案庫",
"core.dataset.file": "檔案",
"core.dataset.folder": "目錄",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function MemberItemCard({
isChecked,
onDelete,
name,
role: permission,
role,
orgs,
addOnly,
rightSlot
Expand All @@ -31,7 +31,7 @@ function MemberItemCard({
orgs?: string[];
rightSlot?: React.ReactNode;
}) {
const isAdded = addOnly && !!permission;
const isAdded = addOnly && !!role;
const onChange = () => {
if (!isAdded) _onChange();
};
Expand Down Expand Up @@ -61,7 +61,7 @@ function MemberItemCard({
</Box>
<Box lineHeight={1}>{orgs && orgs.length > 0 && <OrgTags orgs={orgs} />}</Box>
</Box>
{!isAdded && permission && <RoleTags permission={permission} />}
{!isAdded && role && <RoleTags permission={role} />}
{isAdded && (
<Tag
mixBlendMode={'multiply'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ function RoleSelect({
);
})}

<MyDivider />

{roleOptions.checkboxList.length > 0 && (
<Box pb="2" px="3" fontSize={'sm'} color={'myGray.900'}>
{t('common:permission_other')}
</Box>
<>
<MyDivider />
<Box pb="2" px="3" fontSize={'sm'} color={'myGray.900'}>
{t('common:permission_other')}
</Box>
</>
)}

{roleOptions.checkboxList.map((item) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ const CollaboratorContextProvider = ({
const Per = new Permission({ role });
const labels: string[] = [];

if (Per.isOwner) {
return [t('common:permission.Owner')];
}
if (Per.hasManagePer) {
labels.push(t(roleList['manage'].name as any));
} else if (Per.hasWritePer) {
Expand Down
Loading