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:
Archer
2024-10-28 22:47:45 +08:00
committed by shilin66
parent e45fe46d1c
commit 6932b2984c
29 changed files with 270 additions and 294 deletions

View File

@@ -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
};
};