feat: audit additional events
Thanks for submitting a PR! Please check the boxes below:
- [x] I have run
pre-committo check linting - [x] I have filled in the "Changes" section below?
- [x] I have filled in the "How did you test this code" section below?
- [x] I have used a Conventional Commit title for this Pull Request
Changes
Implements #2797
- refactors
AuditLogto associate with organisation without needing project/environment - audits security-related project, user, group, role, permission changes per organisation
- upgrades and patches django-simple-history to correctly handle indirect m2m signals
- audits user login success/failure and logout signals
- refactors auth mechanisms to send login success/failure and logout signals
Note: python manage.py populate_history --auto must be run after migrations in order to create initial history instances, otherwise the first update to any model will log a warning but create no audit log records.
Note: There are corresponding changes in flagsmith-saml to ensure django signals are sent which must be deployed to correctly audit saml login success/failure.
Note: Does not include front-end changes to view per-organisation audit logs. AuditLog views look for organisation directly/indirectly and should be simplified once organisation field is backfilled for existing records.
How did you test this code?
Tested manually by making changes to memberships and permissions in the front end app or django admin or django shell. Audit log may be inspected per-project or per-environment in the front end but otherwise must be checked using REST API for per-organisation feed or django shell. ~Unit tests will be added once functionality approved. Existing unit tests may fail as I'm currently unable to run them 😞~ Login success/failure tested manually in front end using samltest.id and developer GitHib/Google apps. Unit tests now complete.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 15, 2024 2:22pm |
| flagsmith-frontend-preview | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 15, 2024 2:22pm |
| flagsmith-frontend-staging | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 15, 2024 2:22pm |
Uffizzi Ephemeral Environment deployment-43169
:cloud: https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/2918
:page_facing_up: View Application Logs etc.
What is Uffizzi? Learn more!