-
Notifications
You must be signed in to change notification settings - Fork 415
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
feat: Add role API key (BE) #3346
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
api/api_keys/models.py
Outdated
@@ -18,3 +20,12 @@ class MasterAPIKey(AbstractAPIKey, SoftDeleteObject): | |||
|
|||
objects = MasterAPIKeyManager() | |||
is_admin = models.BooleanField(default=True) | |||
|
|||
@hook(BEFORE_UPDATE, when="is_admin", was=False, is_now=True) | |||
def delete_role_api_keys( |
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.
We should add a test for this method.
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.
The test is here: https://github.com/Flagsmith/flagsmith-rbac/pull/19
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.
In that case, I think we should move all of this code to a signal in the RBAC
repository.
See here for an example:
https://github.com/Flagsmith/flagsmith-ldap/blob/main/flagsmith_ldap/signals.py
https://github.com/Flagsmith/flagsmith-ldap/blob/main/flagsmith_ldap/apps.py
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.
Moved to RBAC
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3346 +/- ##
==========================================
- Coverage 95.95% 95.91% -0.04%
==========================================
Files 1067 1085 +18
Lines 32673 33677 +1004
==========================================
+ Hits 31350 32302 +952
- Misses 1323 1375 +52 ☔ View full report in Codecov by Sentry. |
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
How did you test this code?