Closed oskar1233 closed 7 years ago
@oskar1233 do you have some example code we could look at?
Agreed this should be at least. @oskar1233 do you have an example setup that shows this behaviour?
I found the issue I believe. @oskar1233 can you confirm that this fixes the issue for you?
@hassox It does - thank you very much.
Great! It's merged. We'll cur a release soon
When plugging
Guardian.Permissions.Bitwise
shouldensure
andone_of
check for permission map to be identical or contain at least specified permissions?Now it behaves the first way - when I
plug Guardian.Permissions.Bitwise, ensure: %{superuser: [:mod]}
the permissions can't be higher, e. g.MyApp.Guardian.encode_and_sign(user, %{}, permissions: %{superuser: [:mod, :read]})
will cause{:unauthorized, :unauthorized}
.In my opinion it's unwanted behaviour. I suspect to
plug Guardian.Permissions.Bitwise, ensure: %{superuser: [:mod]}
andplug Guardian.Permissions.Bitwise, ensure: %{superuser: [:read]}
to authorize positively when I specifypermissions: %{superuser: [:mod, :read]}
.Thanks for your attention & regards.