forked from ubccr/coldfront
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow project managers to request secure directories and conditionall…
…y manage users on them (#653) * Allow project managers to request secure dirs; fix bug making inactive projects eligible; fix bug allowing 2nd set of dirs; fix bug allowing request under unrelated project * Add SecureDirRequest.pi field * Add dropdown to select PI in secure dir request flow * Add untested runner class for handling a request to create a new secure directory; update notification email text * Refactor secure dir request view to use runner; remove extraneous logic; clean up breadcrumbs * Rename migration file; fix failing tests given new form step * Remove unused logic for adding PIs to secure directory upon directory request approval * Refactor AllocationDetailView * Allow Project methods for getting PIs/managers to limit to 'Active' * Add/integrate method for determining whether user may manage directory * Notify PI, not requester, that RUA is ready to be signed * Set MOU/RUA filename+contents based on PI or requester based on request type * Remove redundant original copies of moved functions * Refactor/add exception handling to secure dir utils * Update email template context variables * Include new PI field when creating SecureDirRequest in MOU test * Remove unused Project model method * Break up secure_dir_views into four modules * Break up secure_dir_utils * Also email all active PIs upon new directory decisions; adjust tests * Refactor email logic in user management views * Update tests * * Add wrapper object around Allocation representing secure directory * Refactor user management + permissions logic into it * Add runners for secure-dir user management requests * Break up add/remove emails into two files for simplicity * Clean up view for managing secure-dir users * * Avoid repeat DB calls to get directory path * Add in-progress logic to auto-add dir requester to directory * Auto-add requester to dir if has active cluster access * Clean up email handling in secure dir views * Correct import, syntax bugs * Fix failing tests + bugs * Display PI in secure dir request list, detail views * Add migration to fill in SecureDirRequest.pi for existing objs * Add note about manager permissions to 'Add users' template * Correct count of users added/removed to/from dir * * Restore method for fetching PI ProjectUsers to email * Incorporate it so that only those PIs are notified re: secure dir events * Add buttons to navigate back in 'data description' step * Correct phrasing in secure dir request checklist step * Allow secure dir request requester/PI to upload RUA
- Loading branch information
1 parent
de58737
commit e85cd9f
Showing
48 changed files
with
3,480 additions
and
2,746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
coldfront/core/allocation/migrations/0016_securedirrequest_pi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 3.2.5 on 2024-04-23 15:43 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('allocation', '0015_allocationrenewalrequest_renewal_survey_answers'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='securedirrequest', | ||
name='pi', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='secure_dir_request_pi', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='securedirrequest', | ||
name='requester', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='secure_dir_request_requester', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
31 changes: 31 additions & 0 deletions
31
coldfront/core/allocation/migrations/0017_add_pis_to_secure_dir_requests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.db import migrations | ||
|
||
|
||
def set_request_pis_to_requesters(apps, schema_editor): | ||
"""Prior to this migration, only PIs could request new secure | ||
directories. Set the PI of each existing request to be equal to the | ||
requester.""" | ||
SecureDirRequest = apps.get_model('allocation', 'SecureDirRequest') | ||
for secure_dir_request in SecureDirRequest.objects.all(): | ||
secure_dir_request.pi = secure_dir_request.requester | ||
secure_dir_request.save() | ||
|
||
|
||
def unset_request_pis(apps, schema_editor): | ||
"""Unset the PI for all requests.""" | ||
SecureDirRequest = apps.get_model('allocation', 'SecureDirRequest') | ||
for secure_dir_request in SecureDirRequest.objects.all(): | ||
secure_dir_request.pi = None | ||
secure_dir_request.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('allocation', '0016_securedirrequest_pi'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
set_request_pis_to_requesters, unset_request_pis) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
coldfront/core/allocation/templates/secure_dir/secure_dir_request/pi_selection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% extends "common/base.html" %} | ||
{% load crispy_forms_tags %} | ||
{% load static %} | ||
|
||
|
||
{% block title %} | ||
Secure Directory Request: PI Selection | ||
{% endblock %} | ||
|
||
|
||
{% block head %} | ||
{{ wizard.form.media }} | ||
{% endblock %} | ||
|
||
|
||
{% block content %} | ||
<script type="text/javascript" src="{% static 'common/js/leave_form_alert.js' %}"></script> | ||
<script type='text/javascript' src="{% static 'selectize/selectize.min.js' %}"></script> | ||
<link rel='stylesheet' type='text/css' href="{% static 'selectize/selectize.bootstrap3.css' %}"/> | ||
|
||
<h1>Secure Directory: PI Selection</h1><hr> | ||
|
||
{% if breadcrumb_project %} | ||
<ol class="breadcrumb"> | ||
<li>{{ breadcrumb_project }}</li> | ||
</ol> | ||
{% endif %} | ||
|
||
<p>Select a PI of the project. This PI will be asked to sign a Researcher Use Agreement during the approval process.</p> | ||
|
||
<form action="" method="post"> | ||
{% csrf_token %} | ||
<table> | ||
{{ wizard.management_form }} | ||
{% if wizard.form.forms %} | ||
{{ wizard.form.management_form }} | ||
{% for form in wizard.form.forms %} | ||
{{ form|crispy }} | ||
{% endfor %} | ||
{% else %} | ||
{{ wizard.form|crispy }} | ||
{% endif %} | ||
</table> | ||
<input class="btn btn-primary" type="submit" value="Next Step"/> | ||
</form> | ||
<br> | ||
|
||
<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p> | ||
|
||
{% endblock %} |
Oops, something went wrong.