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

Restrict email updates to organization owners and admins only #5317

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

rajpatel24
Copy link
Contributor

πŸ—’οΈ Checklist

  1. run linter locally
  2. update all related docs (API, README, inline, etc.), if any
  3. draft PR with a title <type>(<scope>)<!>: <title> TASK-1234
  4. tag PR: at least frontend or backend unless it's global
  5. fill in the template below and delete template comments
  6. review thyself: read the diff and repro the preview as written
  7. open PR & confirm that CI passes
  8. request reviewers, if needed
  9. delete this section before merging

πŸ“£ Summary

Restrict email updates to organization owners and admins only to ensure proper access control within multi-member organizations.

πŸ“– Description

Previously, any member of an organization could update their email address, regardless of their role. This update enforces a restriction where only organization owners and admins can update their email addresses. Members without these roles are now prevented from making such changes.

πŸ‘· Description for instance maintainers

This update introduces a new restriction to the email update endpoint. It checks the role of the user within the organization and ensures that only users with the owner or admin role in organizations can update their email. This ensures better security and role-based access control. No changes are required for single-member organizations.

πŸ‘€ Preview steps

  1. ℹ️ Have an account and belong to an organization:
  • owner, admin, or member role within an MMO.
  • Or not associated with an MMO.
  1. Login as:
  • Owner: Attempt to update your email. 🟒 Email should be updated successfully.
  • Admin: Attempt to update your email. 🟒 Email should be updated successfully.
  • Member: Attempt to update your email. πŸ”΄ Email update should be blocked with a 400 response.
  • Non-MMO user: Attempt to update your email. 🟒 Email should be updated successfully.

Copy link
Contributor

@noliveleger noliveleger left a comment

Choose a reason for hiding this comment

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

LGTM

kobo/apps/accounts/tests/test_email.py Show resolved Hide resolved
@rajpatel24 rajpatel24 merged commit 028afe5 into main Dec 3, 2024
5 checks passed
@rajpatel24 rajpatel24 deleted the task-1148-disable-email-updates-for-org-members branch December 3, 2024 14:57
rgraber pushed a commit that referenced this pull request Dec 3, 2024
### πŸ“£ Summary
Restrict email updates to organization owners and admins only to ensure
proper access control within multi-member organizations.



### πŸ“– Description
Previously, any member of an organization could update their email
address, regardless of their role. This update enforces a restriction
where only organization owners and admins can update their email
addresses. Members without these roles are now prevented from making
such changes.



### πŸ‘· Description for instance maintainers
This update introduces a new restriction to the email update endpoint.
It checks the role of the user within the organization and ensures that
only users with the `owner` or `admin` role in organizations can update
their email. This ensures better security and role-based access control.
No changes are required for single-member organizations.
Copy link

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

Successfully merging this pull request may close these issues.

2 participants