Skip to content

Commit

Permalink
Merge pull request #305 from UW-GAC/feature/acm-v0.20
Browse files Browse the repository at this point in the history
ACM v0.20.1
  • Loading branch information
amstilp authored Nov 14, 2023
2 parents 4b83f4f + 8e01d1e commit 49d8759
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 49 deletions.
70 changes: 35 additions & 35 deletions gregor_django/gregor_anvil/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_acm_link_with_view_permission(self):
user = User.objects.create_user(username="test-none", password="test-none")
user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.client.force_login(user)
Expand All @@ -64,12 +64,12 @@ def test_acm_link_with_view_and_edit_permission(self):
user = User.objects.create_user(username="test-none", password="test-none")
user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.client.force_login(user)
Expand All @@ -86,7 +86,7 @@ def test_acm_link_with_edit_but_not_view_permission(self):
user = User.objects.create_user(username="test-none", password="test-none")
user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.client.force_login(user)
Expand All @@ -108,7 +108,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -165,7 +165,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -242,7 +242,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -315,7 +315,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -398,7 +398,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -471,7 +471,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -549,12 +549,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
# Data for forms
Expand Down Expand Up @@ -590,7 +590,7 @@ def test_access_with_view_permission(self):
)
user_with_view_perm.user_permissions.add(
Permission.objects.get(
codename=AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
request = self.factory.get(self.get_url())
Expand Down Expand Up @@ -727,7 +727,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -878,7 +878,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -956,7 +956,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -986,12 +986,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.object = factories.UploadWorkspaceFactory.create()
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.workspace_type = "upload"
Expand Down Expand Up @@ -1073,12 +1073,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.workspace_type = "upload"
Expand Down Expand Up @@ -1143,7 +1143,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -1300,7 +1300,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.workspace_type = "example"
Expand Down Expand Up @@ -1332,12 +1332,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.workspace_type = "example"
Expand Down Expand Up @@ -1395,7 +1395,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.object = factories.TemplateWorkspaceFactory.create()
Expand Down Expand Up @@ -1425,7 +1425,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.workspace_type = "template"
Expand Down Expand Up @@ -1457,12 +1457,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.workspace_type = "template"
Expand Down Expand Up @@ -1522,12 +1522,12 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME
)
)
self.object = factories.CombinedConsortiumDataWorkspaceFactory.create()
Expand Down Expand Up @@ -1629,7 +1629,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.object = factories.ReleaseWorkspaceFactory.create()
Expand Down Expand Up @@ -1714,7 +1714,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)

Expand Down Expand Up @@ -1912,7 +1912,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.object = factories.DCCProcessingWorkspaceFactory.create()
Expand Down Expand Up @@ -1942,7 +1942,7 @@ def setUp(self):
self.user = User.objects.create_user(username="test", password="test")
self.user.user_permissions.add(
Permission.objects.get(
codename=acm_models.AnVILProjectManagerAccess.VIEW_PERMISSION_CODENAME
codename=acm_models.AnVILProjectManagerAccess.STAFF_VIEW_PERMISSION_CODENAME
)
)
self.object = factories.DCCProcessedDataWorkspaceFactory.create()
Expand Down
24 changes: 12 additions & 12 deletions gregor_django/gregor_anvil/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from anvil_consortium_manager.auth import (
AnVILConsortiumManagerEditRequired,
AnVILConsortiumManagerViewRequired,
AnVILConsortiumManagerStaffEditRequired,
AnVILConsortiumManagerStaffViewRequired,
)
from anvil_consortium_manager.models import Account, Workspace
from django.contrib.auth import get_user_model
Expand All @@ -16,21 +16,21 @@
User = get_user_model()


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

model = models.ConsentGroup


class ConsentGroupList(AnVILConsortiumManagerViewRequired, SingleTableView):
class ConsentGroupList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""View to show a list of `ConsentGroups`."""

model = models.ConsentGroup
table_class = tables.ConsentGroupTable


class ResearchCenterDetail(
AnVILConsortiumManagerViewRequired, SingleTableMixin, DetailView
AnVILConsortiumManagerStaffViewRequired, SingleTableMixin, DetailView
):
"""View to show details about a `ResearchCenter`."""

Expand All @@ -41,15 +41,15 @@ def get_table(self):
return UserTable(User.objects.filter(research_centers=self.object))


class ResearchCenterList(AnVILConsortiumManagerViewRequired, SingleTableView):
class ResearchCenterList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""View to show a list of `ResearchCenters`."""

model = models.ResearchCenter
table_class = tables.ResearchCenterTable


class PartnerGroupDetail(
AnVILConsortiumManagerViewRequired, SingleTableMixin, DetailView
AnVILConsortiumManagerStaffViewRequired, SingleTableMixin, DetailView
):
"""View to show details about a `PartnerGroup`."""

Expand All @@ -60,15 +60,15 @@ def get_table(self):
return UserTable(User.objects.filter(partner_groups=self.object))


class PartnerGroupList(AnVILConsortiumManagerViewRequired, SingleTableView):
class PartnerGroupList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""View to show a list of `PartnerGroups`."""

model = models.PartnerGroup
table_class = tables.PartnerGroupTable


class UploadCycleCreate(
AnVILConsortiumManagerEditRequired, SuccessMessageMixin, CreateView
AnVILConsortiumManagerStaffEditRequired, SuccessMessageMixin, CreateView
):
"""View to create a new UploadCycle object."""

Expand All @@ -78,7 +78,7 @@ class UploadCycleCreate(


class UploadCycleDetail(
AnVILConsortiumManagerViewRequired, MultiTableMixin, DetailView
AnVILConsortiumManagerStaffViewRequired, MultiTableMixin, DetailView
):
"""View to show details about an `UploadCycle`."""

Expand Down Expand Up @@ -117,14 +117,14 @@ def get_tables_data(self):
]


class UploadCycleList(AnVILConsortiumManagerViewRequired, SingleTableView):
class UploadCycleList(AnVILConsortiumManagerStaffViewRequired, SingleTableView):
"""View to show a list of `UploadCycle` objects."""

model = models.UploadCycle
table_class = tables.UploadCycleTable


class WorkspaceReport(AnVILConsortiumManagerViewRequired, TemplateView):
class WorkspaceReport(AnVILConsortiumManagerStaffViewRequired, TemplateView):
"""View to show report on workspaces"""

template_name = "gregor_anvil/workspace_report.html"
Expand Down
2 changes: 1 addition & 1 deletion gregor_django/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'about' %}">About</a>
</li>
{% if perms.anvil_consortium_manager.anvil_project_manager_view %}
{% if perms.anvil_consortium_manager.anvil_consortium_manager_staff_view %}
<li class="nav-item">
<a class="nav-link" href="{% url 'anvil_consortium_manager:index' %}">AnVIL Consortium Manager</a>
</li>
Expand Down
Loading

0 comments on commit 49d8759

Please sign in to comment.