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

[Reference][WIP] Feature/institutional access #10884

Draft
wants to merge 40 commits into
base: develop
Choose a base branch
from

Conversation

Johnetordoff
Copy link
Contributor

Purpose

Just to ensure the branch is up to snuff.

Changes

QA Notes

Please make verification statements inspired by your code and what your code touches.

  • Verify
  • Verify

What are the areas of risk?

Any concerns/considerations/questions that development raised?

Documentation

Side Effects

Ticket

John Tordoff and others added 30 commits December 5, 2024 14:41
…-message

[ENG-6682] Add UserMessage feature for Institutional Access
…terForOpenScience/osf.io into institutional-access-user-message-arb

* 'feature/institutional_access' of https://github.com/CenterForOpenScience/osf.io:
  add user message read/write permissions to full
  add new user message oauth scope and throttling classes
  Fix backfill, report
  Update changelog and bump versions
  Follow-up fix for target/next (start/end) month
  Fix failures caused by base class MonthlyReporter update
  [ENG-6506] Fix: counted-usage clobbers (#10799)
  [ENG-6435] Fix: duplicate reports when run for past years (#10800)
  Add PrivateSpamMetricsReport (#10791)
  [ENG-4438] Add OOPSpam and Akismet metrics to spam report (#10783)
  [ENG-6364] Migrate Preprint Affilations (#10787)
…-message-arb

[ENG-6682] Add reply-to and cc-ing features to Institutional Access
…terForOpenScience/osf.io into institutional-access-node-request-improvements

* 'feature/institutional_access' of https://github.com/CenterForOpenScience/osf.io:
  change to bcc the sender instead of CC-ing them
  revert typo
  add code to allow cc-ing fellow institutional admins and put their own address as a reply_to

# Conflicts:
#	osf/migrations/0025_noderequest_requested_permissions_and_more.py
…e request access is turned off and added test case
…-request-improvements

[ENG-6666] NodeRequest improvements for Institutional Access Project
 into feature/institutional_access

* 'develop' of https://github.com/CenterForOpenScience/osf.io:
  Assume default  for global_ notifications
  Update CHANGELOG, bump version
  [Feature] Dashboard B&I (#10843)
[Bug} Fix sendgrid email for Institutional Access
[BUG][WIP] Fix sendgrid email 400s and 202s reporting to sentry
add fix to email mocking, test for catagories
Keep institutional_access feature branch up to date with develop
brianjgeiger and others added 4 commits January 8, 2025 13:18
…ntributor_page

[ENG-6670] Make the requested permissions show up as defaults
Add to admin "can_request_access" option to the institution
API Changes for "can_request_access" feature

Done 2 tasks (ENG-6779) and (ENG-6780) within one PR, due to tickets being related to each other
…#10825)

## Purpose

The new Institutional Access feature creates a new "Curator" role that has certain requirements. The first is that it have a special label in the contributor list, shown here: 

The second requirement is that the user is unable to set the curator to a bibliographic or "visible contributor.

## Changes

- Add check constraint to avoid visible institutional admins.
- Locates area in page where Curator status can be lableled
- adds tests to test for specific behavior at model and API level
- adds extra UI notice for contributor page.
* rename migrations for readbility

* fix serialization of `institutional_request_access_enabled` to not be string

---------

Co-authored-by: John Tordoff <>
@@ -1839,7 +1845,11 @@ def set_visible(self, user, visible, log=True, auth=None, save=False):
if visible and not self.contributor_class.objects.filter(**kwargs).exists():
set_visible_kwargs = kwargs
set_visible_kwargs['visible'] = False
self.contributor_class.objects.filter(**set_visible_kwargs).update(visible=True)
contribs = self.contributor_class.objects.filter(**set_visible_kwargs)
if self.guardian_object_type == 'node' and contribs.filter(is_curator=True).exists():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is less then ideal. Potentially this method is a clean-up candidate.

name__endswith='_institutional_admins'
).exists()

def is_institutional_curator(self, node):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No used

}[message_type]


class UserMessage(BaseModel, ObjectIDMixin):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update the docstrings and maybe help_text

)


@receiver(post_save, sender=UserMessage)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just override .create method? post-commit?

@@ -76,17 +76,29 @@ def render_message(tpl_name, **context):


def send_mail(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check docstings and debugging/logging

@@ -41,6 +42,12 @@ class Meta:
# NOTE: Adds an _order column
order_with_respect_to = 'node'

def save(self, *args, **kwargs):
if self.is_curator and self.visible:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like we might have reduced the complexity of this to the point where a DB constraint actually is faster the overriding save.

osf_contact_email=OSF_CONTACT_EMAIL,
**context
)
if not self.machineable.request_type == NodeRequestTypes.INSTITUTIONAL_REQUEST.value:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially rework into NodeRequest object better

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.

3 participants