-
Notifications
You must be signed in to change notification settings - Fork 26
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
2742 kill session user set inactive #2752
base: main
Are you sure you want to change the base?
2742 kill session user set inactive #2752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks broken to me.
if instance.get("is_active"): | ||
if not user.get("is_active"): | ||
self.check_limit_of_user(1) | ||
elif user.get("is_active"): | ||
self.auth.clear_sessions_by_user_id(instance["id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If is_action is not in payload (instance) and user is_active, then clear session", this doesn't seem right.
The is_active payload is optional as far as I know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be repaired now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should give this PR a proper name
def test_update_clear_user_sessions(self) -> None: | ||
self.create_meeting() | ||
self.set_models( | ||
{ | ||
"user/2": { | ||
"is_active": True, | ||
"default_password": "no_password", | ||
"username": "user2", | ||
"password": self.auth.hash("no_password"), | ||
}, | ||
} | ||
) | ||
self.set_user_groups(2, [2]) | ||
self.login(2) | ||
response = self.request( | ||
"user.update", | ||
{ | ||
"id": 2, | ||
}, | ||
) | ||
self.assert_status_code(response, 200) | ||
self.assert_logged_in() | ||
response = self.request( | ||
"user.update", | ||
{ | ||
"id": 2, | ||
"is_active": False, | ||
}, | ||
) | ||
self.assert_status_code(response, 200) | ||
self.assert_model_exists("user/2", {"is_active": False}) | ||
self.assert_logged_out() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be better to just add the upper half of this test to another test, to ensure that we can differentiate what exactly is failing more easily
Closes #2742
Waiting OpenSlides/openslides-auth-service#590