Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/runtime/src/enhancements/policy/policy-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,13 @@ export class PolicyUtil extends QueryUtils {
*/
getCheckerConstraint(model: string, operation: PolicyCrudKind): ReturnType<CheckerFunc> | boolean {
const checker = this.getModelChecker(model);
if (!checker) {
throw this.unknownError(`unable to load policy guard for ${model}`);
}

const provider = checker[operation];
if (typeof provider === 'boolean') {
return provider;
}

if (typeof provider !== 'function') {
throw this.unknownError(`unable to load ${operation} checker for ${model}`);
throw this.unknownError(`invalid ${operation} checker function for ${model}`);
}

// call checker function
Expand Down