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

Deploy to staging #268

Merged
merged 31 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
62af213
Add a publicly visible view for dbGaP records
amstilp Nov 3, 2023
3a2a657
Add a public facing dbGaP applications records page
amstilp Nov 3, 2023
0373fbd
Merge pull request #264 from UW-GAC/feature/public-dbgap-records
amstilp Nov 3, 2023
bbced3b
Add DataPrepWorkspace model
amstilp Nov 7, 2023
ac54d76
Add an adapter for DataPrepWorkspaces
amstilp Nov 7, 2023
2b134c7
Register the DataPrepWorkspaceAdapter
amstilp Nov 8, 2023
9862deb
Update ACM version in requirements
amstilp Nov 8, 2023
89c30b1
Update Auth mixin names for Edit -> StaffEdit
amstilp Nov 8, 2023
c71e60e
Update Auth view mixin names for View -> StaffView
amstilp Nov 8, 2023
ff1c51c
Update Auth mixin names for LimitedView -> View
amstilp Nov 8, 2023
1d51369
Update auth attribute references for EDIT -> STAFF_EDIT
amstilp Nov 8, 2023
ea1aa5d
Update auth attribute references for VIEW -> STAFF VIEW
amstilp Nov 8, 2023
8407d7a
Update auth attribute references for LIMITED_VIEW -> VIEW
amstilp Nov 8, 2023
7e279ca
Fix permissions in user_detail template
amstilp Nov 8, 2023
aebffd1
Fix permissions in the study_detail template
amstilp Nov 9, 2023
07e40e2
Fix permissions in dbGaPApplicationDetail template
amstilp Nov 9, 2023
d526095
Fix dbGaP navbar items for new permissions
amstilp Nov 9, 2023
3e8d5bb
Update CDSA nav items template for new permissions
amstilp Nov 9, 2023
a7ed5d2
Fix permissions in base template
amstilp Nov 9, 2023
d04de1e
Fix permissions in overridden ACM navbar template
amstilp Nov 9, 2023
b25eefb
Merge pull request #265 from UW-GAC/feature/acm-v0.20
amstilp Nov 9, 2023
f4f6aa0
Merge branch 'main' into feature/data-prep-workspace
amstilp Nov 9, 2023
70ab225
Fix permission names after merging with main
amstilp Nov 9, 2023
42fd831
Misc test cleanup after ACM bugfix
amstilp Nov 9, 2023
a300023
Remove unused test case methods
amstilp Nov 9, 2023
af0caae
Forgot to remove unused helper method from last commit
amstilp Nov 9, 2023
21d0195
Remove unrelated, unused comment from other test method
amstilp Nov 9, 2023
5fd7a5b
Fix table displaying target workspace name
amstilp Nov 9, 2023
64c8331
Add is_active field to DataPrepWorkspace model
amstilp Nov 9, 2023
fceeb38
Update ACM version to new patch version in requirements file
amstilp Nov 9, 2023
7a12603
Merge pull request #266 from UW-GAC/feature/data-prep-workspace
amstilp Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@
"cdsa:records:studies",
"cdsa:records:workspaces",
"cdsa:records:user_access",
"dbgap:records:index",
"dbgap:records:applications",
]

# django-dbbackup
Expand Down Expand Up @@ -372,6 +374,7 @@
"primed.dbgap.adapters.dbGaPWorkspaceAdapter",
"primed.cdsa.adapters.CDSAWorkspaceAdapter",
"primed.miscellaneous_workspaces.adapters.ConsortiumDevelWorkspaceAdapter",
"primed.miscellaneous_workspaces.adapters.DataPrepWorkspaceAdapter",
"primed.miscellaneous_workspaces.adapters.ExampleWorkspaceAdapter",
"primed.miscellaneous_workspaces.adapters.SimulatedDataWorkspaceAdapter",
"primed.miscellaneous_workspaces.adapters.OpenAccessWorkspaceAdapter",
Expand Down
156 changes: 110 additions & 46 deletions primed/cdsa/tests/test_views.py

Large diffs are not rendered by default.

50 changes: 27 additions & 23 deletions primed/cdsa/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from anvil_consortium_manager.anvil_api import AnVILAPIError
from anvil_consortium_manager.auth import (
AnVILConsortiumManagerEditRequired,
AnVILConsortiumManagerViewRequired,
AnVILConsortiumManagerStaffEditRequired,
AnVILConsortiumManagerStaffViewRequired,
AnVILProjectManagerAccess,
)
from anvil_consortium_manager.models import GroupAccountMembership, ManagedGroup
Expand All @@ -26,7 +26,7 @@


class AgreementMajorVersionDetail(
AnVILConsortiumManagerViewRequired, MultiTableMixin, DetailView
AnVILConsortiumManagerStaffViewRequired, MultiTableMixin, DetailView
):
"""Display a "detail" page for an agreement major version (e.g., 1.x)."""

Expand Down Expand Up @@ -59,7 +59,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["show_deprecation_message"] = not self.object.is_valid
edit_permission_codename = "anvil_consortium_manager." + (
AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
context[
"show_invalidate_button"
Expand All @@ -70,7 +70,7 @@ def get_context_data(self, **kwargs):


class AgreementMajorVersionInvalidate(
AnVILConsortiumManagerEditRequired, SuccessMessageMixin, UpdateView
AnVILConsortiumManagerStaffEditRequired, SuccessMessageMixin, UpdateView
):
"""A view to invalidate an AgreementMajorVersion instance.

Expand Down Expand Up @@ -132,7 +132,7 @@ def get_success_url(self):


class AgreementVersionDetail(
AnVILConsortiumManagerViewRequired, SingleTableMixin, DetailView
AnVILConsortiumManagerStaffViewRequired, SingleTableMixin, DetailView
):
"""Display a "detail" page for an agreement major/minor version (e.g., 1.3)."""

Expand Down Expand Up @@ -167,14 +167,14 @@ def get_context_data(self, **kwargs):
return context


class AgreementVersionList(AnVILConsortiumManagerViewRequired, SingleTableView):
class AgreementVersionList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""Display a list of AgreementVersions."""

model = models.AgreementVersion
table_class = tables.AgreementVersionTable


class SignedAgreementList(AnVILConsortiumManagerViewRequired, SingleTableView):
class SignedAgreementList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""Display a list of SignedAgreement objects."""

model = models.SignedAgreement
Expand Down Expand Up @@ -294,7 +294,7 @@ def get_success_url(self):


class MemberAgreementCreate(
AnVILConsortiumManagerEditRequired,
AnVILConsortiumManagerStaffEditRequired,
AgreementTypeCreateMixin,
SuccessMessageMixin,
FormView,
Expand All @@ -311,7 +311,7 @@ class MemberAgreementCreate(


class DataAffiliateAgreementCreate(
AnVILConsortiumManagerEditRequired,
AnVILConsortiumManagerStaffEditRequired,
AgreementTypeCreateMixin,
SuccessMessageMixin,
FormView,
Expand Down Expand Up @@ -348,7 +348,7 @@ def get_agreement_type(self, form, formset):
return agreement_type


class MemberAgreementDetail(AnVILConsortiumManagerViewRequired, DetailView):
class MemberAgreementDetail(AnVILConsortiumManagerStaffViewRequired, DetailView):
"""View to show details about a `MemberAgreement`."""

model = models.MemberAgreement
Expand All @@ -371,23 +371,23 @@ def get_context_data(self, **kwargs):
"show_deprecation_message"
] = not self.object.signed_agreement.version.major_version.is_valid
edit_permission_codename = "anvil_consortium_manager." + (
AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
context["show_update_button"] = self.request.user.has_perm(
edit_permission_codename
)
return context


class MemberAgreementList(AnVILConsortiumManagerViewRequired, SingleTableView):
class MemberAgreementList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""Display a list of MemberAgreement objects."""

model = models.MemberAgreement
table_class = tables.MemberAgreementTable


class SignedAgreementStatusUpdate(
AnVILConsortiumManagerEditRequired, SuccessMessageMixin, UpdateView
AnVILConsortiumManagerStaffEditRequired, SuccessMessageMixin, UpdateView
):

model = models.SignedAgreement
Expand All @@ -411,7 +411,7 @@ def get_object(self, queryset=None):
return obj


class DataAffiliateAgreementDetail(AnVILConsortiumManagerViewRequired, DetailView):
class DataAffiliateAgreementDetail(AnVILConsortiumManagerStaffViewRequired, DetailView):
"""View to show details about a `DataAffiliateAgreement`."""

model = models.DataAffiliateAgreement
Expand All @@ -434,23 +434,25 @@ def get_context_data(self, **kwargs):
"show_deprecation_message"
] = not self.object.signed_agreement.version.major_version.is_valid
edit_permission_codename = "anvil_consortium_manager." + (
AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
context["show_update_button"] = self.request.user.has_perm(
edit_permission_codename
)
return context


class DataAffiliateAgreementList(AnVILConsortiumManagerViewRequired, SingleTableView):
class DataAffiliateAgreementList(
AnVILConsortiumManagerStaffViewRequired, SingleTableView
):
"""Display a list of DataAffiliateAgreement objects."""

model = models.DataAffiliateAgreement
table_class = tables.DataAffiliateAgreementTable


class NonDataAffiliateAgreementCreate(
AnVILConsortiumManagerEditRequired,
AnVILConsortiumManagerStaffEditRequired,
AgreementTypeCreateMixin,
SuccessMessageMixin,
FormView,
Expand All @@ -466,7 +468,9 @@ class NonDataAffiliateAgreementCreate(
ERROR_CREATING_GROUP = "Error creating access group on AnVIL."


class NonDataAffiliateAgreementDetail(AnVILConsortiumManagerViewRequired, DetailView):
class NonDataAffiliateAgreementDetail(
AnVILConsortiumManagerStaffViewRequired, DetailView
):
"""View to show details about a `NonDataAffiliateAgreement`."""

model = models.NonDataAffiliateAgreement
Expand All @@ -489,7 +493,7 @@ def get_context_data(self, **kwargs):
"show_deprecation_message"
] = not self.object.signed_agreement.version.major_version.is_valid
edit_permission_codename = "anvil_consortium_manager." + (
AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
context["show_update_button"] = self.request.user.has_perm(
edit_permission_codename
Expand All @@ -498,15 +502,15 @@ def get_context_data(self, **kwargs):


class NonDataAffiliateAgreementList(
AnVILConsortiumManagerViewRequired, SingleTableView
AnVILConsortiumManagerStaffViewRequired, SingleTableView
):
"""Display a list of NonDataAffiliateAgreement objects."""

model = models.NonDataAffiliateAgreement
table_class = tables.NonDataAffiliateAgreementTable


class SignedAgreementAudit(AnVILConsortiumManagerViewRequired, TemplateView):
class SignedAgreementAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView):
"""View to show audit results for `SignedAgreements`."""

template_name = "cdsa/signedagreement_audit.html"
Expand Down Expand Up @@ -538,7 +542,7 @@ def get_context_data(self, **kwargs):
return context


class CDSAWorkspaceAudit(AnVILConsortiumManagerViewRequired, TemplateView):
class CDSAWorkspaceAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView):
"""View to show audit results for `CDSAWorkspaces`."""

template_name = "cdsa/cdsaworkspace_audit.html"
Expand Down
37 changes: 37 additions & 0 deletions primed/dbgap/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,40 @@ class Meta:
model = models.dbGaPDataAccessRequest
fields = ("dbgap_dac", "dbgap_current_status", "total")
attrs = {"class": "table table-sm"}


class dbGaPApplicationRecordsTable(tables.Table):
"""Class to render a publicly-viewable table of dbGaPApplication objects."""

dbgap_project_id = tables.columns.Column()
principal_investigator = tables.columns.Column(
verbose_name="Application PI",
accessor="principal_investigator__name",
)
principal_investigator__study_sites = tables.columns.ManyToManyColumn(
verbose_name="Study site(s)",
)
number_approved_dars = tables.columns.ManyToManyColumn(
accessor="dbgapdataaccesssnapshot_set",
filter=lambda qs: qs.filter(is_most_recent=True),
verbose_name="Number of approved DARs",
transform=lambda obj: obj.dbgapdataaccessrequest_set.approved().count(),
)
number_requested_dars = tables.columns.ManyToManyColumn(
accessor="dbgapdataaccesssnapshot_set",
filter=lambda qs: qs.filter(is_most_recent=True),
verbose_name="Number of requested DARs",
transform=lambda obj: obj.dbgapdataaccessrequest_set.count(),
)
last_update = ManyToManyDateTimeColumn(
accessor="dbgapdataaccesssnapshot_set",
filter=lambda qs: qs.filter(is_most_recent=True),
)

class Meta:
model = models.dbGaPApplication
fields = (
"dbgap_project_id",
"principal_investigator",
)
order_by = ("dbgap_project_id",)
Loading