mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
fix: permission conflict after moving (#3639)
This commit is contained in:
@@ -23,6 +23,7 @@ import { authUserPer } from '@fastgpt/service/support/permission/user/auth';
|
||||
import { TeamWritePermissionVal } from '@fastgpt/global/support/permission/user/constant';
|
||||
import { AppErrEnum } from '@fastgpt/global/common/error/code/app';
|
||||
import { refreshSourceAvatar } from '@fastgpt/service/common/file/image/controller';
|
||||
import { MongoResourcePermission } from '@fastgpt/service/support/permission/schema';
|
||||
|
||||
export type AppUpdateQuery = {
|
||||
appId: string;
|
||||
@@ -148,6 +149,12 @@ async function handler(req: ApiRequestProps<AppUpdateBody, AppUpdateQuery>) {
|
||||
collaborators: parentClbsAndGroups,
|
||||
session
|
||||
});
|
||||
} else {
|
||||
// Not folder, delete all clb
|
||||
await MongoResourcePermission.deleteMany(
|
||||
{ resourceType: PerResourceTypeEnum.app, teamId: app.teamId, resourceId: app._id },
|
||||
{ session }
|
||||
);
|
||||
}
|
||||
return onUpdate(session);
|
||||
});
|
||||
|
@@ -29,6 +29,7 @@ import { MongoDatasetTraining } from '@fastgpt/service/core/dataset/training/sch
|
||||
import { MongoDatasetCollection } from '@fastgpt/service/core/dataset/collection/schema';
|
||||
import { addDays } from 'date-fns';
|
||||
import { refreshSourceAvatar } from '@fastgpt/service/common/file/image/controller';
|
||||
import { MongoResourcePermission } from '@fastgpt/service/support/permission/schema';
|
||||
|
||||
export type DatasetUpdateQuery = {};
|
||||
export type DatasetUpdateResponse = any;
|
||||
@@ -175,6 +176,12 @@ async function handler(
|
||||
collaborators: parentClbsAndGroups,
|
||||
session
|
||||
});
|
||||
} else {
|
||||
// Not folder, delete all clb
|
||||
await MongoResourcePermission.deleteMany(
|
||||
{ resourceId: id, teamId: dataset.teamId, resourceType: PerResourceTypeEnum.dataset },
|
||||
{ session }
|
||||
);
|
||||
}
|
||||
return onUpdate(session);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user