Skip to content

Commit

Permalink
Merge pull request #233 from UW-GAC/feature/cdsa-invalidation
Browse files Browse the repository at this point in the history
CDSA invalidation
  • Loading branch information
amstilp authored Sep 29, 2023
2 parents 6b16c6b + 3dd387f commit 72c13d1
Show file tree
Hide file tree
Showing 42 changed files with 4,591 additions and 429 deletions.
14 changes: 11 additions & 3 deletions add_cdsa_example_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ManagedGroupFactory,
WorkspaceGroupSharingFactory,
)
from django.conf import settings

from primed.cdsa.tests import factories
from primed.duo.tests.factories import DataUseModifierFactory, DataUsePermissionFactory
Expand All @@ -17,16 +18,23 @@
from primed.users.models import User
from primed.users.tests.factories import UserFactory

# Create major versions
major_version = factories.AgreementMajorVersionFactory.create(version=1)

# Create some agreement versions
v10 = factories.AgreementVersionFactory.create(major_version=1, minor_version=0)
v11 = factories.AgreementVersionFactory.create(major_version=1, minor_version=1)
v10 = factories.AgreementVersionFactory.create(
major_version=major_version, minor_version=0
)
v11 = factories.AgreementVersionFactory.create(
major_version=major_version, minor_version=1
)

# Create a couple signed CDSAs.
dup = DataUsePermissionFactory.create(abbreviation="GRU")
dum = DataUseModifierFactory.create(abbreviation="NPU")

# create the CDSA auth group
cdsa_group = ManagedGroupFactory.create(name="PRIMED_CDSA")
cdsa_group = ManagedGroupFactory.create(name=settings.ANVIL_CDSA_GROUP_NAME)

# Create some study sites.
StudySiteFactory.create(short_name="CARDINAL", full_name="CARDINAL")
Expand Down
1 change: 1 addition & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@
ANVIL_DATA_ACCESS_GROUP_PREFIX = env(
"ANVIL_DATA_ACCESS_GROUP_PREFIX", default="DEV_PRIMED"
)
ANVIL_CDSA_GROUP_NAME = env("ANVIL_CDSA_GROUP_NAME", default="DEV_PRIMED_CDSA")
30 changes: 26 additions & 4 deletions primed/cdsa/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,33 @@
from . import models


@admin.register(models.AgreementMajorVersion)
class AgreementMajorVersion(SimpleHistoryAdmin):
"""Admin class for the `AgreementMajorVersion` model."""

list_display = (
"version",
"is_valid",
)
list_filter = (
"version",
"is_valid",
)
sortable_by = ("version",)


@admin.register(models.AgreementVersion)
class AgreementVersion(SimpleHistoryAdmin):
"""Admin class for the `AgreementVersion` model."""

list_display = (
"full_version",
"major_version",
"minor_version",
"date_approved",
)
list_filter = ("major_version",)
list_filter = (
"major_version",
"major_version__is_valid",
)
sortable_by = (
"major_version",
"minor_version",
Expand All @@ -38,6 +54,7 @@ class SignedAgreement(SimpleHistoryAdmin):
"type",
"is_primary",
"version",
"status",
)
search_fields = (
"representative",
Expand All @@ -63,6 +80,7 @@ class MemberAgreementAdmin(SimpleHistoryAdmin):
list_filter = (
"study_site",
"signed_agreement__is_primary",
"signed_agreement__status",
)


Expand All @@ -77,6 +95,7 @@ class DataAffiliateAgreementAdmin(SimpleHistoryAdmin):
list_filter = (
"study",
"signed_agreement__is_primary",
"signed_agreement__status",
)


Expand All @@ -88,7 +107,10 @@ class NonDataAffiliateAgreementAdmin(SimpleHistoryAdmin):
"signed_agreement",
"affiliation",
)
list_filter = ("signed_agreement__is_primary",)
list_filter = (
"signed_agreement__is_primary",
"signed_agreement__status",
)


@admin.register(models.CDSAWorkspace)
Expand Down
Loading

0 comments on commit 72c13d1

Please sign in to comment.