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
Purpose
This is the project BE PR for Preprints Institution Affiliation.
It comprises the following PRs that were merged into the feature branch
Changes
AffiliatedInstitutionMixin
mixin toPreprint
model and overridesaffiliated_institutions
with related name.PreprintLog
save=False
inadd_affiliated_institution()
PreprintInstitutionsList
: this endpoint is read-only, use existingInstitutionSerializer
and newPreprintInstitutionPermissionList
PreprintInstitutionsRelationship
: this endpoint only allowsGET
andPUT
, uses newPreprintsInstitutionsRelationshipSerializer
and updatedWriteOrPublicForRelationshipInstitutions
PreprintsInstitutionsRelationshipSerializer
forPreprintInstitutionsRelationship
InstitutionRelated
fromnodes
toinstitutions
affiliated_institutions
toPreprintSerializer
handle_author_assertions()
WriteOrPublicForRelationshipInstitutions
fromnodes
tobase
and add a special case forPreprint
PreprintInstitutionPermissionList
: this is a permission for read-only endpointhandle_author_assertions()
Preprints.can_edit()
.nodes
toinstitutions
and added a new helperupdate_institutions_if_user_associated()
QA Notes
See project QA Planning
Documentation
See https://github.com/CenterForOpenScience/developer.osf.io/pull/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