-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1799] Add tests for cms cases-plugin
- Loading branch information
Showing
6 changed files
with
482 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
|
||
from open_inwoner.openzaak.cases import fetch_roles_for_case_and_bsn | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def check_user_auth(user, digid_required: bool = False) -> bool: | ||
if not user.is_authenticated: | ||
logger.debug("Permission denied: user not authenticated") | ||
return False | ||
if digid_required and not getattr(user, "bsn", None): | ||
logger.debug("Permission denied: user has no BSN") | ||
return False | ||
return True | ||
|
||
|
||
def check_user_access_rights(user, case_url) -> bool: | ||
if not fetch_roles_for_case_and_bsn(case_url, user.bsn): | ||
f"Permission denied: no role for the case {case_url}" | ||
return False | ||
return True |
Oops, something went wrong.