-
Notifications
You must be signed in to change notification settings - Fork 815
Robustly clear sessions on user deletion to cause immediate logout #13757
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
Open
rtibbles
wants to merge
5
commits into
learningequality:develop
Choose a base branch
from
rtibbles:unhandle_my_lod
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
46b66b6
Abstract our database router pattern into an abstract base class.
rtibbles 6e9e1b7
Change from file backed sessions to custom cached_db sessions.
rtibbles f8d12a8
Add session cleanup on hard and soft deletion of users.
rtibbles 85b98da
Fix potential regression in facility deletion to ensure that soft del…
rtibbles 59e4106
Update all tests that use the sessions database to "__all__" databases.
rtibbles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 3.2.25 on 2025-09-17 02:30 | ||
import morango.models.fields.uuids | ||
from django.db import migrations | ||
from django.db import models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("kolibriauth", "0030_alter_facilityuser_managers"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Session", | ||
fields=[ | ||
( | ||
"session_key", | ||
models.CharField( | ||
max_length=40, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="session key", | ||
), | ||
), | ||
("session_data", models.TextField(verbose_name="session data")), | ||
( | ||
"expire_date", | ||
models.DateTimeField(db_index=True, verbose_name="expire date"), | ||
), | ||
( | ||
"user_id", | ||
morango.models.fields.uuids.UUIDField( | ||
blank=True, db_index=True, null=True | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "session", | ||
"verbose_name_plural": "sessions", | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(non blocking opinion) -
__init__
feels like it should always be at the top of a class to me but as I type this I'm feeling like this is largely based on vibes 😆 -- I think maybe I just like to see overrides at the top of a class so I can first answer the question "what is the class doing in relation to it's parent's implementation" then the second question of "now what does this class do uniquely".In any case -
__str__
is overridden down here too so the rest fit in well enough 😄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.
Yeah - I think I have a similar intuition - the only advantage to it being here is that its closer to where the intialized value is used.