Skip to content

Commit

Permalink
Add note to remind us to remove/update logic handling legacy API keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tillprochaska committed Jul 30, 2024
1 parent a28d36a commit c702ab4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aleph/model/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ def by_api_key(cls, api_key):
q = cls.all()
q = q.filter_by(api_key=api_key)
utcnow = datetime.now(timezone.utc)

# TODO: Exclude API keys without expiration date after deadline
# See https://github.com/alephdata/aleph/issues/3729
q = q.filter(
or_(
cls.api_key_expires_at == None, # noqa: E711
utcnow < cls.api_key_expires_at,
)
)

q = q.filter(cls.type == cls.USER)
q = q.filter(cls.is_blocked == False) # noqa
return q.first()
Expand Down

0 comments on commit c702ab4

Please sign in to comment.