Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: misc code improvements #1439

Merged
merged 1 commit into from
May 12, 2024
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}`);
ymc9 marked this conversation as resolved.
Show resolved Hide resolved
}

// call checker function
Expand Down
Loading