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

2742 kill session user set inactive #2752

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hjanott
Copy link
Member

@hjanott hjanott commented Dec 2, 2024

@hjanott hjanott added the enhancement General enhancement which is neither bug nor feature label Dec 2, 2024
@hjanott hjanott added this to the 4.2 milestone Dec 2, 2024
@hjanott hjanott self-assigned this Dec 2, 2024
Copy link
Member

@reiterl reiterl left a 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.

Comment on lines 143 to 147
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"])
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@luisa-beerboom luisa-beerboom left a 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

Comment on lines +2424 to +2455
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()
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancement which is neither bug nor feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove sessions if user is set to inactive
3 participants