Skip to content

Commit

Permalink
Fixed issue, when user has no role, but has permissions and object_ch…
Browse files Browse the repository at this point in the history
…ecker returned false
  • Loading branch information
zurek11 committed Oct 15, 2020
1 parent 293214d commit 9844667
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
## 0.1.1 : 2020-10-05

- 🌧 Changed Django version requirement from 3.0.* to >= 2.0

## 0.1.2 : 2020-10-05

- 😺 Fixed issue, when user has no role, but has permissions and object_checker returned false.
5 changes: 1 addition & 4 deletions object_checker/base_object_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def has_object_permission(checker_name: str, user: User, obj) -> bool:
checker = ObjectChecker.retrieve_checker(checker_name)
user_roles = ObjectChecker.get_user_roles(user)

if user_roles:
has_permission = any([checker(user_role, user, obj) for user_role in user_roles])
else:
has_permission = False
has_permission = any([checker(user_role, user, obj) for user_role in user_roles])

return has_permission
2 changes: 1 addition & 1 deletion object_checker/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.1'
__version__ = '0.1.2'

0 comments on commit 9844667

Please sign in to comment.