Fiabiliser les exceptions RBAC expirees
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
ab543cad3a
commit
12a66dc6da
1 changed files with 5 additions and 1 deletions
|
|
@ -109,7 +109,11 @@ def has_permission(permission, user=None):
|
|||
if link.effect == "allow" and link.permission.is_active}
|
||||
denied = set()
|
||||
for override in user.permission_links:
|
||||
if override.expires_at and override.expires_at < datetime.now(timezone.utc):
|
||||
now = datetime.now(timezone.utc)
|
||||
expiry = override.expires_at
|
||||
if expiry and expiry.tzinfo is None:
|
||||
expiry = expiry.replace(tzinfo=timezone.utc)
|
||||
if expiry and expiry < now:
|
||||
continue
|
||||
(granted if override.effect == "allow" else denied).add(override.permission.code)
|
||||
if permission in denied:
|
||||
|
|
|
|||
Loading…
Reference in a new issue