mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Merge branch 'main' of github.com:directus/directus into main
This commit is contained in:
@@ -52,17 +52,7 @@ export class AuthorizationService {
|
||||
const uniqueCollectionsRequestedCount = uniq(collectionsRequested.map(({ collection }) => collection)).length;
|
||||
|
||||
if (uniqueCollectionsRequestedCount !== permissionsForCollections.length) {
|
||||
// Find the first collection that doesn't have permissions configured
|
||||
const { collection, field } = collectionsRequested.find(
|
||||
({ collection }) =>
|
||||
permissionsForCollections.find((permission) => permission.collection === collection) === undefined
|
||||
)!;
|
||||
|
||||
if (field) {
|
||||
throw new ForbiddenException(`You don't have permission to access the "${field}" field.`);
|
||||
} else {
|
||||
throw new ForbiddenException(`You don't have permission to access the "${collection}" collection.`);
|
||||
}
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
validateFields(ast);
|
||||
|
||||
@@ -200,6 +200,7 @@ export class ItemsService<Item extends AnyItem = AnyItem> implements AbstractSer
|
||||
knex: this.knex,
|
||||
stripNonRequested: opts?.stripNonRequested !== undefined ? opts.stripNonRequested : true,
|
||||
});
|
||||
|
||||
return records as Partial<Item> | Partial<Item>[] | null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user