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

Add ability to create, update project invitations #2430

Merged
merged 73 commits into from
Jul 20, 2023

Conversation

kelvin-muchiri
Copy link
Contributor

@kelvin-muchiri kelvin-muchiri commented May 26, 2023

Changes / Features implemented

  • Added get project invitation list endpoint
  • Added create/update project invitation endpoint
  • Added resend project invitation endpoint
  • Added revoke project invitation endpoint
  • Added templates for the project invitation email subject and body
  • Sends a project invitation when a project invitation is created, resent, or recipient email is updated
  • Handles accepting of a project invitation. The invitation is accepted when a new user successfully creates an account. All projects that the new user was invited to are shared with the user.

Steps taken to verify this change does what is intended

  • QA

Side effects of implementing this change

Ability to create and manage a project invitation resource and send project invitations to unregistered recipients

Before submitting this PR for review, please make sure you have:

  • Included tests
  • Updated documentation

Closes #2425

@kelvin-muchiri kelvin-muchiri marked this pull request as draft May 26, 2023 07:41
@kelvin-muchiri kelvin-muchiri marked this pull request as ready for review May 30, 2023 08:58
@kelvin-muchiri kelvin-muchiri changed the title Project Invitation Endpoints Add ability to create, update project invitiations Jun 2, 2023
@kelvin-muchiri kelvin-muchiri marked this pull request as draft June 5, 2023 06:12
onadata/apps/logger/models/project_invitation.py Outdated Show resolved Hide resolved
onadata/apps/logger/models/project_invitation.py Outdated Show resolved Hide resolved
KipSigei
KipSigei previously approved these changes Jun 26, 2023
@KipSigei KipSigei marked this pull request as ready for review June 30, 2023 13:12
@KipSigei KipSigei force-pushed the 2425-project-invitation branch 4 times, most recently from ed63e3e to 8ecc0e6 Compare July 6, 2023 12:45
# pylint: disable=import-outside-toplevel
from onadata.libs.models.share_project import ShareProject

for invitation in invitation_qs:
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use queryset_iterator util to iterate through the invitations queryset

@kelvin-muchiri kelvin-muchiri force-pushed the 2425-project-invitation branch 2 times, most recently from 0bb9537 to 84b1df8 Compare July 20, 2023 10:18
there can be multiple revoked invitations. To support this, unique together integrity check has been removed. To prevent duplicate invitations from being created, a validation check has been added to the create invitation endpoint
add missing method docstring
If id and token are invalid or are not provided but the user registers using an email that matches a pending invitation, then that project is shared with the user.
fix failing test
remove PATCH support endpoint /api/v1/projects/{pk}/invitations
update documentation
when the email does not change when updating invitation, the error 'Invitation already exists' occurred. The fix was to have the check for uniqueness only when creating
ensure only pending invitations can be updated
* remove project invitation id and token verification

remove invitation_id and invitation_token query params from invitation email link.
remove support for allowing a user to register using a different email from the one the invite was sent to
add a post_save signal to accept only invitations that match the new user email and remove implementation for accepting invitation from the UserProfileSerializer. This is because a user can also be created using OIDC

* update project invitation documentation
fix AttributeError: 'NoneType' object has no attribute 'lower' when creating a user with password field missing from the payload
@kelvin-muchiri kelvin-muchiri changed the title Add ability to create, update project invitiations Add ability to create, update project invitations Jul 20, 2023
@kelvin-muchiri kelvin-muchiri merged commit ea3ac4f into main Jul 20, 2023
@kelvin-muchiri kelvin-muchiri deleted the 2425-project-invitation branch July 20, 2023 13:20
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.

Add ability to create, update project invitiations
3 participants