Skip to content

feat: django-rest-framework + Person/Email API#8233

Merged
jennifer-richards merged 29 commits into
ietf-tools:feat/subscriptionsfrom
jennifer-richards:drf
Nov 20, 2024
Merged

feat: django-rest-framework + Person/Email API#8233
jennifer-richards merged 29 commits into
ietf-tools:feat/subscriptionsfrom
jennifer-richards:drf

Conversation

@jennifer-richards

@jennifer-richards jennifer-richards commented Nov 18, 2024

Copy link
Copy Markdown
Member

This adds django-rest-framework to the datatracker and implements the first few API endpoints using it. These allow a user to retrieve their set of email addresses, update them, and request new email addresses.

I've put the datatracker API under /api/core/ anticipating that we'll have other endpoints. A schema is served at /api/schema/

This does not yet enforce a single "primary" address. That should be enforced by the UI initially. I'll add an enhancement that prevents multiple addresses from being assigned as primary.

Permissions are done via session cookies. For the PATCH/POST/PUT API calls the CSRF token must be sent both in the X-CSRFToken header and in the csrftoken cookie.

Note that some existing code was refactored to share code with the API.

More work will be needed on this, but it's definitely time to get more eyes on it.

for pat in settings.EXCLUDED_PERSONAL_EMAIL_REGEX_PATTERNS:
if re.search(pat, value):
raise ValidationError(
"This email address is not valid in a datatracker account"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this is old, but is it conflating User.username concerns with Email.address concerns? If so, we should clarify.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is doing things like preventing some-wg-list@ietf.org from being signed up as an email. I don't think it's for the username concerns.

@jennifer-richards

Copy link
Copy Markdown
Member Author

The new API needs tests and some work on view naming / namespacing for URL reversing, but I'm going to leave those as separate work so we can move forward on the feat branch.

@jennifer-richards
jennifer-richards merged commit ec797da into ietf-tools:feat/subscriptions Nov 20, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants