Skip to content

Commit

Permalink
#135: Allow users to logout from Python ICAT backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Jun 24, 2020
1 parent dbe8ba1 commit 8ca17eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions common/python_icat_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from common.backend import Backend
from common.helpers import queries_records
from common.python_icat_helpers import requires_session_id, get_session_details_helper
from common.python_icat_helpers import requires_session_id, get_session_details_helper, logout_icat_client
from common.config import config
from common.exceptions import AuthenticationError
from common.models.db_models import SESSION
Expand Down Expand Up @@ -43,7 +43,8 @@ def refresh(self, session_id):
@requires_session_id
@queries_records
def logout(self, session_id):
pass
self.client.sessionId = session_id
return logout_icat_client(self.client)

@requires_session_id
@queries_records
Expand Down
4 changes: 4 additions & 0 deletions common/python_icat_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ def get_session_details_helper(client):
username = client.getUserName()

return {"ID": client.sessionId, "EXPIREDATETIME": str(session_expiry_time), "USERNAME": username}


def logout_icat_client(client):
client.logout()

0 comments on commit 8ca17eb

Please sign in to comment.