diff --git a/gregor_django/gregor_anvil/tests/test_views.py b/gregor_django/gregor_anvil/tests/test_views.py index bc93214d..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,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) @@ -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) @@ -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,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 @@ -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,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() @@ -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,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" @@ -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,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" @@ -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,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" @@ -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() @@ -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() diff --git a/gregor_django/gregor_anvil/views.py b/gregor_django/gregor_anvil/views.py index 3f5ba059..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 ( - AnVILConsortiumManagerEditRequired, - AnVILConsortiumManagerViewRequired, + AnVILConsortiumManagerStaffEditRequired, + 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 @@ -68,7 +68,7 @@ class PartnerGroupList(AnVILConsortiumManagerViewRequired, SingleTableView): class UploadCycleCreate( - AnVILConsortiumManagerEditRequired, SuccessMessageMixin, CreateView + AnVILConsortiumManagerStaffEditRequired, SuccessMessageMixin, CreateView ): """View to create a new UploadCycle object.""" @@ -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" 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 @@