From 8e3550b3b3b1e5a06ac19771d18b951bfab633db Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:23:42 -0800 Subject: [PATCH 1/6] Update ACM version in requirementes file --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index c5d881c8..ddfbe436 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -21,7 +21,7 @@ django-login-required-middleware==0.8.0 # https://github.com/CleitonDeLima/djang django-dbbackup==4.0.1 # https://github.com/jazzband/django-dbbackup django-extensions==3.2.1 # https://github.com/django-extensions/django-extensions -git+https://github.com/UW-GAC/django-anvil-consortium-manager.git@v0.19 +git+https://github.com/UW-GAC/django-anvil-consortium-manager.git@v0.20.1 # Simple history - model history tracking django-simple-history==3.1.1 # For tracking history From dbfed30c78c5ae990f52990cee56255c6735efda Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:24:00 -0800 Subject: [PATCH 2/6] Update auth view mixin name for Edit -> StaffEdit --- gregor_django/gregor_anvil/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gregor_django/gregor_anvil/views.py b/gregor_django/gregor_anvil/views.py index 3f5ba059..80181e05 100644 --- a/gregor_django/gregor_anvil/views.py +++ b/gregor_django/gregor_anvil/views.py @@ -1,5 +1,5 @@ from anvil_consortium_manager.auth import ( - AnVILConsortiumManagerEditRequired, + AnVILConsortiumManagerStaffEditRequired, AnVILConsortiumManagerViewRequired, ) from anvil_consortium_manager.models import Account, Workspace @@ -68,7 +68,7 @@ class PartnerGroupList(AnVILConsortiumManagerViewRequired, SingleTableView): class UploadCycleCreate( - AnVILConsortiumManagerEditRequired, SuccessMessageMixin, CreateView + AnVILConsortiumManagerStaffEditRequired, SuccessMessageMixin, CreateView ): """View to create a new UploadCycle object.""" From 156987ebbdc18e829a3803336b5bc2e16f5d925e Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:24:57 -0800 Subject: [PATCH 3/6] Update auth mixin names for View -> StaffView --- gregor_django/gregor_anvil/views.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gregor_django/gregor_anvil/views.py b/gregor_django/gregor_anvil/views.py index 80181e05..62eeaa93 100644 --- a/gregor_django/gregor_anvil/views.py +++ b/gregor_django/gregor_anvil/views.py @@ -1,6 +1,6 @@ from anvil_consortium_manager.auth import ( AnVILConsortiumManagerStaffEditRequired, - AnVILConsortiumManagerViewRequired, + AnVILConsortiumManagerStaffViewRequired, ) from anvil_consortium_manager.models import Account, Workspace from django.contrib.auth import get_user_model @@ -16,13 +16,13 @@ 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 @@ -30,7 +30,7 @@ class ConsentGroupList(AnVILConsortiumManagerViewRequired, SingleTableView): class ResearchCenterDetail( - AnVILConsortiumManagerViewRequired, SingleTableMixin, DetailView + AnVILConsortiumManagerStaffViewRequired, SingleTableMixin, DetailView ): """View to show details about a `ResearchCenter`.""" @@ -41,7 +41,7 @@ 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 @@ -49,7 +49,7 @@ class ResearchCenterList(AnVILConsortiumManagerViewRequired, SingleTableView): class PartnerGroupDetail( - AnVILConsortiumManagerViewRequired, SingleTableMixin, DetailView + AnVILConsortiumManagerStaffViewRequired, SingleTableMixin, DetailView ): """View to show details about a `PartnerGroup`.""" @@ -60,7 +60,7 @@ 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 @@ -78,7 +78,7 @@ class UploadCycleCreate( class UploadCycleDetail( - AnVILConsortiumManagerViewRequired, MultiTableMixin, DetailView + AnVILConsortiumManagerStaffViewRequired, MultiTableMixin, DetailView ): """View to show details about an `UploadCycle`.""" @@ -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" From e3b551306701aa1b2a0f5c70271cc45bfded3728 Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:28:03 -0800 Subject: [PATCH 4/6] Update auth attribute references for EDIT -> STAFF_EDIT --- gregor_django/gregor_anvil/tests/test_views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gregor_django/gregor_anvil/tests/test_views.py b/gregor_django/gregor_anvil/tests/test_views.py index bc93214d..c55ab833 100644 --- a/gregor_django/gregor_anvil/tests/test_views.py +++ b/gregor_django/gregor_anvil/tests/test_views.py @@ -69,7 +69,7 @@ def test_acm_link_with_view_and_edit_permission(self): ) 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) @@ -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) @@ -554,7 +554,7 @@ def setUp(self): ) self.user.user_permissions.add( Permission.objects.get( - codename=AnVILProjectManagerAccess.EDIT_PERMISSION_CODENAME + codename=AnVILProjectManagerAccess.STAFF_EDIT_PERMISSION_CODENAME ) ) # Data for forms @@ -991,7 +991,7 @@ def setUp(self): ) 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() @@ -1078,7 +1078,7 @@ def setUp(self): ) 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" @@ -1337,7 +1337,7 @@ def setUp(self): ) 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" @@ -1462,7 +1462,7 @@ def setUp(self): ) 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" @@ -1527,7 +1527,7 @@ def setUp(self): ) 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() From c50989a1c934dd007b5580914ce98885ef41714c Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:28:49 -0800 Subject: [PATCH 5/6] Update auth attribute references for VIEW -> STAFF_VIEW --- .../gregor_anvil/tests/test_views.py | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/gregor_django/gregor_anvil/tests/test_views.py b/gregor_django/gregor_anvil/tests/test_views.py index c55ab833..99186128 100644 --- a/gregor_django/gregor_anvil/tests/test_views.py +++ b/gregor_django/gregor_anvil/tests/test_views.py @@ -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) @@ -64,7 +64,7 @@ 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( @@ -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 ) ) @@ -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 ) ) @@ -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 ) ) @@ -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 ) ) @@ -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 ) ) @@ -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 ) ) @@ -549,7 +549,7 @@ 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( @@ -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()) @@ -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 ) ) @@ -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 ) ) @@ -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 ) ) @@ -986,7 +986,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.user.user_permissions.add( @@ -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" @@ -1073,7 +1073,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.user.user_permissions.add( @@ -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 ) ) @@ -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" @@ -1332,7 +1332,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.user.user_permissions.add( @@ -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() @@ -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" @@ -1457,7 +1457,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.user.user_permissions.add( @@ -1522,7 +1522,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.user.user_permissions.add( @@ -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() @@ -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 ) ) @@ -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() @@ -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() From 8e01d1edd7fbcf7e3e2cc0a62204f2059eba425c Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 13 Nov 2023 16:40:15 -0800 Subject: [PATCH 6/6] Update permissions in base template --- gregor_django/templates/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gregor_django/templates/base.html b/gregor_django/templates/base.html index 3db81590..4cab446f 100644 --- a/gregor_django/templates/base.html +++ b/gregor_django/templates/base.html @@ -94,7 +94,7 @@ - {% if perms.anvil_consortium_manager.anvil_project_manager_view %} + {% if perms.anvil_consortium_manager.anvil_consortium_manager_staff_view %}