Skip to content

Commit

Permalink
Merge pull request #482 from creative-commoners/pulls/3/remove-support
Browse files Browse the repository at this point in the history
API Remove silverstripe/campaign-admin integration support
  • Loading branch information
GuySartorelli authored Nov 28, 2024
2 parents 6b8999b + 36e06e5 commit 1fe9568
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
9 changes: 4 additions & 5 deletions src/ChangeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -98,15 +98,14 @@ 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.
*
* @config
* @var array
*/
private static $required_permission = [
'CMS_ACCESS_CampaignAdmin',
'CMS_ACCESS_LeftAndMain'
];

Expand Down Expand Up @@ -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
*/
Expand Down
21 changes: 0 additions & 21 deletions tests/php/ChangeSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 1fe9568

Please sign in to comment.