@directus/api 23.1.1 → 23.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ export interface ValidateAccessOptions {
6
6
  collection: string;
7
7
  primaryKeys?: PrimaryKey[];
8
8
  fields?: string[];
9
+ skipCollectionExistsCheck?: boolean;
9
10
  }
10
11
  /**
11
12
  * Validate if the current user has access to perform action against the given collection and
@@ -8,7 +8,7 @@ import { validateItemAccess } from './lib/validate-item-access.js';
8
8
  */
9
9
  export async function validateAccess(options, context) {
10
10
  // Skip further validation if the collection does not exist
11
- if (options.collection in context.schema.collections === false) {
11
+ if (!options.skipCollectionExistsCheck && options.collection in context.schema.collections === false) {
12
12
  throw new ForbiddenError({
13
13
  reason: `You don't have permission to "${options.action}" from collection "${options.collection}" or it does not exist.`,
14
14
  });
@@ -155,11 +155,10 @@ export class CollectionsService {
155
155
  if (opts?.autoPurgeSystemCache !== false) {
156
156
  await clearSystemCache({ autoPurgeCache: opts?.autoPurgeCache });
157
157
  }
158
- // Refresh the schema for subsequent reads
159
- this.schema = await getSchema();
160
158
  if (opts?.emitEvents !== false && nestedActionEvents.length > 0) {
159
+ const updatedSchema = await getSchema();
161
160
  for (const nestedActionEvent of nestedActionEvents) {
162
- nestedActionEvent.context.schema = this.schema;
161
+ nestedActionEvent.context.schema = updatedSchema;
163
162
  emitter.emitAction(nestedActionEvent.event, nestedActionEvent.meta, nestedActionEvent.context);
164
163
  }
165
164
  }
@@ -197,11 +196,10 @@ export class CollectionsService {
197
196
  if (opts?.autoPurgeSystemCache !== false) {
198
197
  await clearSystemCache({ autoPurgeCache: opts?.autoPurgeCache });
199
198
  }
200
- // Refresh the schema for subsequent reads
201
- this.schema = await getSchema();
202
199
  if (opts?.emitEvents !== false && nestedActionEvents.length > 0) {
200
+ const updatedSchema = await getSchema();
203
201
  for (const nestedActionEvent of nestedActionEvents) {
204
- nestedActionEvent.context.schema = this.schema;
202
+ nestedActionEvent.context.schema = updatedSchema;
205
203
  emitter.emitAction(nestedActionEvent.event, nestedActionEvent.meta, nestedActionEvent.context);
206
204
  }
207
205
  }
@@ -290,6 +288,7 @@ export class CollectionsService {
290
288
  accountability: this.accountability,
291
289
  action: 'read',
292
290
  collection,
291
+ skipCollectionExistsCheck: true,
293
292
  }, {
294
293
  schema: this.schema,
295
294
  knex: this.knex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "23.1.1",
3
+ "version": "23.1.2",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -149,29 +149,29 @@
149
149
  "ws": "8.18.0",
150
150
  "zod": "3.23.8",
151
151
  "zod-validation-error": "3.4.0",
152
- "@directus/app": "13.3.1",
152
+ "@directus/app": "13.3.2",
153
153
  "@directus/constants": "12.0.0",
154
154
  "@directus/env": "3.1.3",
155
155
  "@directus/errors": "1.0.1",
156
- "@directus/extensions": "2.0.4",
157
156
  "@directus/extensions-registry": "2.0.4",
157
+ "@directus/extensions": "2.0.4",
158
158
  "@directus/extensions-sdk": "12.1.2",
159
159
  "@directus/format-title": "11.0.0",
160
- "@directus/pressure": "2.0.3",
161
160
  "@directus/memory": "2.0.4",
161
+ "@directus/pressure": "2.0.3",
162
162
  "@directus/schema": "12.1.1",
163
163
  "@directus/specs": "11.1.0",
164
- "@directus/storage-driver-azure": "11.1.0",
165
- "@directus/storage-driver-cloudinary": "11.1.0",
166
164
  "@directus/storage": "11.0.1",
165
+ "@directus/storage-driver-azure": "11.1.0",
167
166
  "@directus/storage-driver-gcs": "11.1.0",
167
+ "@directus/storage-driver-cloudinary": "11.1.0",
168
168
  "@directus/storage-driver-local": "11.0.1",
169
169
  "@directus/storage-driver-s3": "11.0.3",
170
170
  "@directus/storage-driver-supabase": "2.1.0",
171
- "@directus/utils": "12.0.3",
172
171
  "@directus/system-data": "2.1.1",
173
172
  "@directus/validation": "1.0.3",
174
- "directus": "11.2.0"
173
+ "@directus/utils": "12.0.3",
174
+ "directus": "11.2.1"
175
175
  },
176
176
  "devDependencies": {
177
177
  "@ngneat/falso": "7.2.0",