DNP: Extend UserRestrictionHistory to record matched restriction instances - #25337
Closed
jasonBirchall wants to merge 1 commit into
Closed
DNP: Extend UserRestrictionHistory to record matched restriction instances#25337jasonBirchall wants to merge 1 commit into
jasonBirchall wants to merge 1 commit into
Conversation
When a RestrictionChecker fails we currently record only which restriction class it failed on, not which specific restriction row matched. The matching row is known at the point of failure, but then discarded. so the reviewers and Redash can see "an email restriction fired" and never "becaude of the pattern *@example.com" for example. This add the schema to hold that, but it doesn't actually wire it up just yet: - restriction_type, upload and version on UserRestrictionHistory, so a record says which action was being checked and what it applied to. Existing records predate them, the request-based paths have no upload, and the version is only known after the check runs. - UserRestrictionHistoryMatch, holding one row per matched restriction. A child model rather than fields, because a single failed check can match several restrictions. The link is a generic foreign key since matches span five restriction models, alongside a snapshot of str() at match time. A failure with no matches is legitimate and the schema allows it: some restrictions classes are not backed by the database at all. The ones that are can deny structurally without any row being involved.
Author
|
closed by #25344 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I gave up in this attempt and decided to go with #25344