mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 17:29:44 +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:
@@ -20,6 +20,7 @@ import { MongoDatasetData } from '../../../core/dataset/data/schema';
|
||||
import { AuthModeType, AuthResponseType } from '../type';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { DatasetDefaultPermissionVal } from '@fastgpt/global/support/permission/dataset/constant';
|
||||
|
||||
export const authDatasetByTmbId = async ({
|
||||
tmbId,
|
||||
@@ -62,7 +63,7 @@ export const authDatasetByTmbId = async ({
|
||||
const isOwner = tmbPer.isOwner || String(dataset.tmbId) === String(tmbId);
|
||||
|
||||
// get dataset permission or inherit permission from parent folder.
|
||||
const { Per, defaultPermission } = await (async () => {
|
||||
const { Per } = await (async () => {
|
||||
if (
|
||||
dataset.type === DatasetTypeEnum.folder ||
|
||||
dataset.inheritPermission === false ||
|
||||
@@ -78,12 +79,11 @@ export const authDatasetByTmbId = async ({
|
||||
resourceType: PerResourceTypeEnum.dataset
|
||||
});
|
||||
const Per = new DatasetPermission({
|
||||
per: rp ?? dataset.defaultPermission,
|
||||
per: rp ?? DatasetDefaultPermissionVal,
|
||||
isOwner
|
||||
});
|
||||
return {
|
||||
Per,
|
||||
defaultPermission: dataset.defaultPermission
|
||||
Per
|
||||
};
|
||||
} else {
|
||||
// is not folder and inheritPermission is true and is not root folder.
|
||||
@@ -100,8 +100,7 @@ export const authDatasetByTmbId = async ({
|
||||
});
|
||||
|
||||
return {
|
||||
Per,
|
||||
defaultPermission: parent.defaultPermission
|
||||
Per
|
||||
};
|
||||
}
|
||||
})();
|
||||
@@ -112,7 +111,6 @@ export const authDatasetByTmbId = async ({
|
||||
|
||||
return {
|
||||
...dataset,
|
||||
defaultPermission,
|
||||
permission: Per
|
||||
};
|
||||
})();
|
||||
@@ -179,14 +177,15 @@ export async function authDatasetCollection({
|
||||
tmbId,
|
||||
datasetId: collection.datasetId._id,
|
||||
per,
|
||||
isRoot: isRootFromHeader || isRoot
|
||||
isRoot: isRootFromHeader
|
||||
});
|
||||
|
||||
return {
|
||||
teamId,
|
||||
tmbId,
|
||||
collection,
|
||||
permission: dataset.permission
|
||||
permission: dataset.permission,
|
||||
isRoot: isRootFromHeader
|
||||
};
|
||||
}
|
||||
|
||||
@@ -231,7 +230,8 @@ export async function authDatasetFile({
|
||||
teamId,
|
||||
tmbId,
|
||||
file,
|
||||
permission
|
||||
permission,
|
||||
isRoot
|
||||
};
|
||||
} catch (error) {
|
||||
return Promise.reject(DatasetErrEnum.unAuthDatasetFile);
|
||||
|
Reference in New Issue
Block a user