Merge branch 'main' of github.com:directus/directus into main

This commit is contained in:
rijkvanzanten
2021-03-03 17:17:13 -05:00
2 changed files with 2 additions and 11 deletions

View File

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

View File

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