Skip to content

Commit

Permalink
raise exception
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyxi authored Sep 23, 2024
1 parent bd8bebc commit d8d81bf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions wsgidav/dc/pam_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ def __init__(self, wsgidav_app, config):
self.pam_encoding = dc_conf.get("encoding", "utf-8")
self.pam_resetcreds = dc_conf.get("resetcreds", True)
self.allow_users = dc_conf.get("allow_users", "all")
assert self.allow_users in ("all", "current") or isinstance(self.allow_users, list), \
f"Invalid 'allow_users' value: {self.allow_users!r}, expected 'all', 'current' or list of allowed users."
if not (self.allow_users in ("all", "current") or isinstance(self.allow_users, list)):
raise ValueError(
f"Invalid 'allow_users' value: {self.allow_users!r}, expected 'all', 'current' or list of allowed users."
)
self.deny_users = dc_conf.get("deny_users", [])
assert isinstance(self.deny_users, list), \
f"Invalid 'deny_users' value: {self.deny_users!r}, expected list of denied users."
if not isinstance(self.deny_users, list):
raise ValueError(
f"Invalid 'deny_users' value: {self.deny_users!r}, expected list of denied users."
)

def __str__(self):
return f"{self.__class__.__name__}({self.pam_service!r})"
Expand Down

0 comments on commit d8d81bf

Please sign in to comment.