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

[ENG-5028] [ENG-5920] Preprints Affiliation Project PR (BE) #10745

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

cslzchen
Copy link
Collaborator

@cslzchen cslzchen commented Sep 9, 2024

Purpose

This is the project BE PR for Preprints Institution Affiliation.

It comprises the following PRs that were merged into the feature branch

Changes

  • Model
    • Add AffiliatedInstitutionMixin mixin to Preprint model and overrides affiliated_institutions with related name.
    • Add affiliation add/remove to PreprintLog
    • Remove deprecated save=False in add_affiliated_institution()
  • API
    • New Endpoint:
      • PreprintInstitutionsList: this endpoint is read-only, use existing InstitutionSerializer and new PreprintInstitutionPermissionList
      • PreprintInstitutionsRelationship: this endpoint only allows GET and PUT, uses new PreprintsInstitutionsRelationshipSerializer and updated WriteOrPublicForRelationshipInstitutions
    • Serializer:
      • New PreprintsInstitutionsRelationshipSerializer for PreprintInstitutionsRelationship
      • Move InstitutionRelated from nodes to institutions
      • Add affiliated_institutions to PreprintSerializer
      • Move assertion checks into one helper method handle_author_assertions()
    • Permission
      • Move WriteOrPublicForRelationshipInstitutions from nodes to base and add a special case for Preprint
      • Add PreprintInstitutionPermissionList: this is a permission for read-only endpoint
      • Verified that WRITE user can't do the following three:
        • Manage contributor (except for removing themselves), this doesn't require any code change, since contributor has its own endpoint and permission
        • Can't change author assertion, this is in handle_author_assertions()
        • Can't withdraw preprint, this doesn't require any code change either, since it's also handled by existing code outside of Preprints.can_edit().
    • Moved helper methods from nodes to institutions and added a new helper update_institutions_if_user_associated()
  • Share
    • Add tests to make sure that direct affiliation info is sent to share
  • Unit tests
  • API Doc: see [ENG-5891] 1.2.7 BE: Update API documentation (developer.osf.io) developer.osf.io#63

QA Notes

See project QA Planning

Documentation

See CenterForOpenScience/developer.osf.io#63, make sure we release documentation to developer.osf.io too.

Side Effects

N/A

Ticket

Project: https://openscience.atlassian.net/browse/ENG-5028
BE: https://openscience.atlassian.net/browse/ENG-5920

@cslzchen cslzchen mentioned this pull request Sep 9, 2024
@cslzchen cslzchen marked this pull request as ready for review September 9, 2024 18:37
Copy link
Collaborator

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

Small things, mostly test related.

[ENG-5829] Add Institutional Affiliation mix-in to Preprints #10649
[ENG-5844] Add preprint institution affiliation endpoint #10655
[ENG-5845] Preprint Institutions Relationship #10659
[ENG-5846][ENG-5847] Add affiliated_institutions to preprint list and detail endpoint #10684
[Bug-fix] Fix Self Link for Preprint Affiliated Institutions #10698
[ENG-5908] Add Test Confirming Preprint Affiliated Institution Data is Sent to SHARE #10700
[ENG-5966] 2.0.1 BE: Update permission to support edit as a WRITE contributor #10741
@cslzchen cslzchen force-pushed the feature/preprints-affiliations branch from dadfbae to 9bcd800 Compare September 16, 2024 22:11
* Fixed self url for PreprintsInstitutionsRelationshipSerializer
* Removed the superfluous 'html' link that is not part of JSON:API
* Fixed incorrect tests
@cslzchen
Copy link
Collaborator Author

Note: there is some weird but unrelated test failures for my local env

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