Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: User cannot login if previous user did not logout #1455

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

dominikatrojanowska
Copy link
Contributor

@dominikatrojanowska dominikatrojanowska commented Oct 17, 2024

Depends on: mxcube/mxcubecore#1066

KeyError regarding Proposal was blocking effective log in in case of:

  • another user was logged
  • and an active proposal was not accessible by the current user

When, so called, another user logged out, the login (by pressing Sign in button on login page) of current user was still impossible because the current user already appeared as active (https://github.com/mxcube/mxcubeweb/blob/develop/mxcubeweb/core/components/user/usermanager.py#L343)
Log in was possible when the another user logs out and instead of clicking Sign in button the session was refreshed.

@dominikatrojanowska dominikatrojanowska changed the title User cannot login if previous user did not logout Draft: User cannot login if previous user did not logout Oct 17, 2024
@dominikatrojanowska dominikatrojanowska changed the title Draft: User cannot login if previous user did not logout User cannot login if previous user did not logout Oct 17, 2024
@dominikatrojanowska dominikatrojanowska marked this pull request as draft October 17, 2024 13:14
@dominikatrojanowska dominikatrojanowska marked this pull request as ready for review November 12, 2024 16:04
# Test against proposal-based authentication only
@pytest.mark.parametrize("login_type", ["proposal"], indirect=True)
def test_authn_different_proposal(make_client):
"""Test two users for different proposals.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is not actually testing for different proposals, its testing two users with the same proposal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will cherry pick from develop for this piece

and "Commissioning" in proposal_info["Proposal"]["title"]
):
if hasattr(HWR.beamline.session, "set_in_commissioning"):
if proposal_info:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it these lines that caused the issue ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue was TypeError (if proposal_info was None) or KeyError raised here:

and Commissioning" in proposal_info["Proposal"]["title"]

instead of returning False at the end, and finally it was carried and re-raised here: https://github.com/mxcube/mxcubeweb/blob/develop/mxcubeweb/routes/login.py#L43

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...user already appeared as active (https://github.com/mxcube/mxcubeweb/blob/develop/mxcubeweb/core/components/user/usermanager.py#L343)

I see, the first comment above threw me off a bit. So I imagine that this is with user based login ? Out of curiosity how come that proposal_info was None ?

Copy link
Contributor Author

@dominikatrojanowska dominikatrojanowska Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for my mistake - it was some time ago I was debugging that, the error raised here was KeyError caused by 1st or 2nd keyword, and of course proposal_info may be an empty dict, not None

@marcus-oscarsson
Copy link
Member

Hi @dominikatrojanowska and @fabcor-maxiv Where in the PR is the actual issue solved ?

@dominikatrojanowska dominikatrojanowska changed the title User cannot login if previous user did not logout Draft: User cannot login if previous user did not logout Nov 13, 2024
@marcus-oscarsson marcus-oscarsson marked this pull request as draft November 13, 2024 12:41
@marcus-oscarsson
Copy link
Member

So If understand this correctly the issue you are facing is that you can't login with two different users belonging to the same proposal/session ?

@marcus-oscarsson
Copy link
Member

@dominikatrojanowska: As we mentioned before, I suggest that you try this use case with the AbstractLims PR's and perhaps your issue is solved, let us know how it goes ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants