From f6dcfae28c470d91003d885b28cafa894ed111df Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 12 Apr 2021 18:10:59 +0800 Subject: [PATCH] refactor: use boolean value instead of null (#74) --- .../src/AccessController.ts | 19 +++++++++---------- packages/plugin-permissions/src/server.ts | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/plugin-permissions/src/AccessController.ts b/packages/plugin-permissions/src/AccessController.ts index c35481fdb..372c817fe 100644 --- a/packages/plugin-permissions/src/AccessController.ts +++ b/packages/plugin-permissions/src/AccessController.ts @@ -84,7 +84,7 @@ export type CollectionPermissions = { tabs: any[] }; -export type PermissionParams = true | null | { +export type PermissionParams = boolean | { filter: any, fields: any[] }; @@ -175,7 +175,7 @@ export default class AccessController { const any = await this.any(); - if (!any || any === true) { + if (typeof any === 'boolean') { return any; } @@ -209,7 +209,7 @@ export default class AccessController { @@ -338,12 +338,11 @@ export default class AccessController