Skip to content

Commit

Permalink
Make sure we return always the last created API key
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Sep 27, 2022
1 parent c059a36 commit 5bd74c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/galaxy/managers/api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ def __init__(self, app: BasicSharedApp):

def get_api_key(self, user: User) -> Optional[APIKeys]:
sa_session = self.app.model.context
api_key = sa_session.query(APIKeys).filter_by(user_id=user.id, deleted=False).first()
api_key = (
sa_session.query(APIKeys)
.filter_by(user_id=user.id, deleted=False)
.order_by(APIKeys.create_time.desc())
.first()
)
return api_key

def create_api_key(self, user: User) -> APIKeys:
Expand Down

0 comments on commit 5bd74c9

Please sign in to comment.