From fe1909aa32f5c050f6cd81233b995f8e98d2e734 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 27 Nov 2024 13:45:54 +1300 Subject: [PATCH] API Remove silverstripe/campaign-admin integration support --- src/ChangeSet.php | 9 ++++----- tests/php/ChangeSetTest.php | 21 --------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/ChangeSet.php b/src/ChangeSet.php index c3e5f315..0f8080e9 100644 --- a/src/ChangeSet.php +++ b/src/ChangeSet.php @@ -35,9 +35,9 @@ */ class ChangeSet extends DataObject { - private static $singular_name = 'Campaign'; + private static $singular_name = 'Changeset'; - private static $plural_name = 'Campaigns'; + private static $plural_name = 'Changesets'; /** An active changeset */ const STATE_OPEN = 'open'; @@ -98,7 +98,7 @@ class ChangeSet extends DataObject /** * Default permission to require for publishers. - * Publishers must either be able to use the campaign admin, or have all admin access. + * Publishers must have access to all admin access. * * Also used as default permission for ChangeSetItem default permission. * @@ -106,7 +106,6 @@ class ChangeSet extends DataObject * @var array */ private static $required_permission = [ - 'CMS_ACCESS_CampaignAdmin', 'CMS_ACCESS_LeftAndMain' ]; @@ -635,7 +634,7 @@ public function getStateLabel() } /** - * Gets the full name of the user who last published this campaign + * Gets the full name of the user who last published this ChangeSet * * @return string */ diff --git a/tests/php/ChangeSetTest.php b/tests/php/ChangeSetTest.php index 8bf43647..52b504ff 100644 --- a/tests/php/ChangeSetTest.php +++ b/tests/php/ChangeSetTest.php @@ -351,19 +351,6 @@ public function testCanPublish() $this->logInWithPermission('PERM_canPublish'); $this->assertTrue($changeSet->canPublish()); - // Test user with the necessary minimum permissions can login - $this->logInWithPermission( - [ - 'CMS_ACCESS_CampaignAdmin', - 'PERM_canPublish' - ] - ); - $this->assertTrue($changeSet->canPublish()); - - // campaign admin only permission doesn't grant publishing rights - $this->logInWithPermission('CMS_ACCESS_CampaignAdmin'); - $this->assertFalse($changeSet->canPublish()); - // Test that you can still publish a changeset, even if canPublish() // returns false (e.g. externally rather than internally enforced) $changeSet->publish(); @@ -448,8 +435,6 @@ public function testCanEdit() $this->assertFalse($changeSet->canEdit()); $this->logInWithPermission('SomeWrongPermission'); $this->assertFalse($changeSet->canEdit()); - $this->logInWithPermission('CMS_ACCESS_CampaignAdmin'); - $this->assertTrue($changeSet->canEdit()); } public function testCanCreate() @@ -459,8 +444,6 @@ public function testCanCreate() $this->assertFalse(ChangeSet::singleton()->canCreate()); $this->logInWithPermission('SomeWrongPermission'); $this->assertFalse(ChangeSet::singleton()->canCreate()); - $this->logInWithPermission('CMS_ACCESS_CampaignAdmin'); - $this->assertTrue(ChangeSet::singleton()->canCreate()); } public function testCanDelete() @@ -479,8 +462,6 @@ public function testCanDelete() $this->assertFalse($changeSet->canDelete()); $this->logInWithPermission('SomeWrongPermission'); $this->assertFalse($changeSet->canDelete()); - $this->logInWithPermission('CMS_ACCESS_CampaignAdmin'); - $this->assertTrue($changeSet->canDelete()); } public function testCanView() @@ -499,8 +480,6 @@ public function testCanView() $this->assertFalse($changeSet->canView()); $this->logInWithPermission('SomeWrongPermission'); $this->assertFalse($changeSet->canView()); - $this->logInWithPermission('CMS_ACCESS_CampaignAdmin'); - $this->assertTrue($changeSet->canView()); } public function testPublish()