Commit ea3ac4f
Add ability to create, update project invitations (#2430)
* add ProjectInvitation model
model to store a project invitation details
* APIRequestFactory test
* add tests for get project invitations list
* add tests for get project invitations list
* add create project invitation endpoint
* add tests for create project invitation endpoint
* update project invitation role
* add endpoint to revoke project invitation
* add endpoint to resend project invitation
* update comments
* restore onadata/libs/filters.py
* make project invitation status readonly
have status field in create project invitation endpoint readonly
* add project invitation endpoints documentation
add API documentation
remove project key from API response
* format project invitations documentation
* format project invitations documentation
* format project invitations documentation
* format project invitations documentation
* format project invitations documentation
* update path for revoke, resend project invitation
* expose ProjectInvitation model to Django admin
* revert changes to expose ProjectInvitation in Django admin
* fix lint errors
fix lint errors for file onadata/libs/serializers/project_invitation_serializer
* fix lint errors
fix lint errors for file onadata/apps/logger/models/project_invitation.py
* fix cylic dependency
* fix linting errors
* refactor code
* add code comments
* refactor code
* suppress linting error
suppress linting error abstract-method / Method 'create' is abstract in class 'BaseSerializer' but is not overridden
* remove duplicate variable declaration
* separate update project invitation from create
* add test case to update project invitation
* fix typo in docs
* fix typo in docs
* Send and accept project invitation (#2443)
* send project invitation email
* add tests for ProjectInvitationEmailTestCase and refactor
* accept project invitation
accept all pending project invitations when user creates account
* have invitation_id, invitation_token as query params
change invitation_id, invitation_token from being submitted as part of the payload but instead
received from query params
* add tests for tasks
add tests for send_project_invitation_email_async, accept_project_invitation_async
* add documentation for accept project invitation
* enhance project invitation docs
* enhance project invitation docs
* update method docstring
* update method docstring
* fix rst typos in docs
* fix rst typos in docs
* fix rst typos in docs
* fix rst typos in docs
* add fields invited_by, accepted_by for ProjectInvitation
* remove unused code
* update docs
* add test case
* provide flexibility to add extra context data to invitation email templates
* catch exceptions
* refactor code
* refactor code
* fix linting error
* fix linting errors
* fix linting erros
* fix linting erros
* fix linting errors
* fix linting errors
* fix linting errors
* fix linting errors
* fix linting errors
* Update invitations url path
Signed-off-by: Kipchirchir Sigei <[email protected]>
* Fix typon in invitations endpoint methods
Signed-off-by: Kipchirchir Sigei <[email protected]>
* Cleanup
Signed-off-by: Kipchirchir Sigei <[email protected]>
* remove HTML ampersand character from invitation mail
* remove unique together ProjectInvitation model
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
* refactor code
* add temporary logging for debugging
* log temporarily for debugging
* log temporarily for debugging
* log temp for debuggig
* remove debugging logs
* fix linting error
add missing method docstring
* share projects if invitation invalid/missing
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.
* refactor code
* fix failing test
fix failing test
remove PATCH support endpoint /api/v1/projects/{pk}/invitations
update documentation
* update documentatio
* update documentation
* fix bug when working with multipart/formdata
* fix typo in docs
* fix Invitation already exists when updating invitation
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
* fix 'User already exists' when updating an accepted invitation
ensure only pending invitations can be updated
* send project invtation email when email is updated
* fix typo
* Only accept project invitations whose email match new user email (#2449)
* 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 linting errors
* fix error when creating user with no password
fix AttributeError: 'NoneType' object has no attribute 'lower' when creating a user with password field missing from the payload
* validate password if not None when creating user
* refactor cod
* use queryset_iterator to iterate queryset
---------
Signed-off-by: Kipchirchir Sigei <[email protected]>
Co-authored-by: Kipchirchir Sigei <[email protected]>1 parent caf1fef commit ea3ac4f
File tree
23 files changed
+2023
-97
lines changed- docs
- onadata
- apps
- api
- tests
- viewsets
- urls
- viewsets
- logger
- migrations
- models
- tests/models
- main
- tests
- libs
- serializers
- templates/projects
- tests/utils
- utils
23 files changed
+2023
-97
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
515 | 516 | | |
516 | 517 | | |
517 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
| |||
278 | 277 | | |
279 | 278 | | |
280 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
| |||
306 | 311 | | |
307 | 312 | | |
308 | 313 | | |
309 | | - | |
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
390 | | - | |
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments