Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
fixes #241
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneJeon committed Jan 31, 2022
1 parent 4d09a09 commit 3a79c90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class Post extends authorize(Model) {
}
```

(Again, for now the only supported `library` value is `casl`)

### Options

You can pass an _optional_ options object as the third parameter during initialization. The default values are as follows:
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const pick = require('lodash/pick')
const merge = require('lodash/merge')
const isString = require('lodash/isString')

// TODO: @sssss465 I mean like this kind of shit
async function fillResourceContext(args) {
Expand All @@ -11,8 +12,8 @@ async function fillResourceContext(args) {
args.context._authorize = OGValue
}

module.exports = (acl, library = 'role-acl', opts) => {
if (!acl || typeof library === 'object') {
module.exports = (acl, library, opts) => {
if (!acl || !isString(library)) {
throw new Error(
"usage: require('objection-authorize')(acl, library: String[, opts: Object])(Model)"
)
Expand Down

0 comments on commit 3a79c90

Please sign in to comment.