mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 02:15:12 +00:00
Merge pull request #12948 from nocodb/nc-fix/context-is-api-token
set is_api_token to context correctly also fix the typescript definit…
This commit is contained in:
@@ -19,6 +19,10 @@ export interface NcContext {
|
||||
suppressDependencyEvaluation?: boolean;
|
||||
additionalContext?: Record<string, any>;
|
||||
schema_locked?: boolean;
|
||||
cache?: boolean;
|
||||
cacheMap?: any;
|
||||
permissions?: any;
|
||||
is_api_token?: boolean;
|
||||
}
|
||||
|
||||
export interface NcRequest extends Partial<Request> {
|
||||
|
||||
@@ -1113,6 +1113,10 @@ export class AclMiddleware implements NestInterceptor {
|
||||
NcError.sourceDataReadOnly(source.alias);
|
||||
}
|
||||
}
|
||||
|
||||
if (req.context) {
|
||||
req.context.is_api_token = req.user.is_api_token;
|
||||
}
|
||||
}
|
||||
|
||||
async intercept(
|
||||
|
||||
@@ -268,7 +268,10 @@ async function createDemoTable({
|
||||
break;
|
||||
}
|
||||
|
||||
await api.dbTableRow.bulkCreate('noco', context.base.id, table.id, rowAttributes);
|
||||
const BATCH_SIZE = 100;
|
||||
for (let i = 0; i < rowAttributes.length; i += BATCH_SIZE) {
|
||||
await api.dbTableRow.bulkCreate('noco', context.base.id, table.id, rowAttributes.slice(i, i + BATCH_SIZE));
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user