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

Explore swappable API key model functionality #191

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

florimondmanca
Copy link
Owner

@florimondmanca florimondmanca commented Dec 5, 2021

This is an illustration of a possible resolution for #180.

  • Allows users to define a default API key model they'd like to use.
  • If "a default API key model" does not make sense for their use case (e.g. maybe they have multiple custom API key models), then the default APIKey model would still get created. I'm not sure there's a sensible way out of this, because allowing dropping the model midways, e.g. via API_KEY_MODEL = None, would add migration questions for existing apps.
  • However, this PR also proposes to not register() any API key models by default, meaning at least they wouldn't see it in the admin. It's possible we want this to be a separate, isolated PR.

This would be a fully backwards-compatible change, as the default behavior would match the existing APIKey-based behavior — except for the admin dropout, which we'd need to document as a change.

cc @virogenesis What do you think about this?

@codecov-commenter
Copy link

Codecov Report

Merging #191 (5f20bf9) into master (dd806cf) will decrease coverage by 0.66%.
The diff coverage is 78.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #191      +/-   ##
==========================================
- Coverage   96.55%   95.88%   -0.67%     
==========================================
  Files          22       22              
  Lines         522      535      +13     
==========================================
+ Hits          504      513       +9     
- Misses         18       22       +4     
Impacted Files Coverage Δ
src/rest_framework_api_key/models.py 96.00% <75.00%> (-4.00%) ⬇️
src/rest_framework_api_key/admin.py 76.00% <100.00%> (-0.93%) ⬇️
src/rest_framework_api_key/permissions.py 94.73% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd806cf...5f20bf9. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants