mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 09:44:47 +00:00
4.8.12 test (#3006)
* perf: oneapi error tip * fix: qps limit condition error * perf: Plan tip * fix: permission modal ui * perf: dataset slider ui * perf: api key auth tmbId problem * perf: dataset upload i18n * fix: http json path check
This commit is contained in:
@@ -527,15 +527,14 @@ const authHeaderRequest = async ({
|
||||
teamId,
|
||||
tmbId,
|
||||
authType,
|
||||
apikey,
|
||||
canWrite: apiKeyCanWrite
|
||||
apikey
|
||||
} = await authCert({
|
||||
req,
|
||||
authToken: true,
|
||||
authApiKey: true
|
||||
});
|
||||
|
||||
const { app, canWrite } = await (async () => {
|
||||
const { app } = await (async () => {
|
||||
if (authType === AuthUserTypeEnum.apikey) {
|
||||
if (!apiKeyAppId) {
|
||||
return Promise.reject(
|
||||
@@ -551,16 +550,14 @@ const authHeaderRequest = async ({
|
||||
appId = String(app._id);
|
||||
|
||||
return {
|
||||
app,
|
||||
canWrite: apiKeyCanWrite
|
||||
app
|
||||
};
|
||||
} else {
|
||||
// token_auth
|
||||
|
||||
if (!appId) {
|
||||
return Promise.reject('appId is empty');
|
||||
}
|
||||
const { app, permission } = await authApp({
|
||||
const { app } = await authApp({
|
||||
req,
|
||||
authToken: true,
|
||||
appId,
|
||||
@@ -568,8 +565,7 @@ const authHeaderRequest = async ({
|
||||
});
|
||||
|
||||
return {
|
||||
app,
|
||||
canWrite: permission.hasReadPer
|
||||
app
|
||||
};
|
||||
}
|
||||
})();
|
||||
@@ -579,7 +575,12 @@ const authHeaderRequest = async ({
|
||||
MongoChat.findOne({ appId, chatId }).lean()
|
||||
]);
|
||||
|
||||
if (chat && (String(chat.teamId) !== teamId || String(chat.tmbId) !== tmbId)) {
|
||||
if (
|
||||
chat &&
|
||||
(String(chat.teamId) !== teamId ||
|
||||
// There's no need to distinguish who created it if it's apiKey auth
|
||||
(authType === AuthUserTypeEnum.token && String(chat.tmbId) !== tmbId))
|
||||
) {
|
||||
return Promise.reject(ChatErrEnum.unAuthChat);
|
||||
}
|
||||
|
||||
@@ -591,7 +592,7 @@ const authHeaderRequest = async ({
|
||||
responseDetail: true,
|
||||
apikey,
|
||||
authType,
|
||||
canWrite
|
||||
canWrite: true
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user