diff --git a/.travis.yml b/.travis.yml
index 4c01b9546..192557ec1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -53,13 +53,12 @@ before_script:
- "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"1\" ]; then (vendor/bin/serve --bootstrap-file cms/tests/behat/serve-bootstrap.php &> serve.log &); fi"
script:
- - "if [ \"$PHPUNIT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"\" ]; then vendor/bin/phpunit; fi"
+ - "if [ \"$PHPUNIT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"\" ]; then vendor/bin/phpunit tests/php; fi"
- "if [ \"$PHPUNIT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"1\" ]; then vendor/bin/phpunit cms/tests; fi"
- "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"\" ]; then vendor/bin/behat --config tests/behat/config.yml .; fi"
- "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"1\" ]; then vendor/bin/behat @cms --config tests/behat/cms-config.yml; fi"
- "if [ \"$NPM_TEST\" = \"1\" ]; then git diff-files --quiet -w; fi"
- "if [ \"$NPM_TEST\" = \"1\" ]; then git diff -w --no-color; fi"
- - "if [ \"$NPM_TEST\" = \"1\" ]; then yarn run test; fi"
- "if [ \"$NPM_TEST\" = \"1\" ]; then yarn run lint; fi"
- "if [ \"$PHPCS_TEST\" = \"1\" ]; then composer run-script lint; fi"
diff --git a/.upgrade.yml b/.upgrade.yml
index 11da32579..6d1db7c39 100644
--- a/.upgrade.yml
+++ b/.upgrade.yml
@@ -171,7 +171,7 @@ mappings:
CMSBatchActionHandler: SilverStripe\Admin\CMSBatchActionHandler
CMSMenu: SilverStripe\Admin\CMSMenu
CMSMenuItem: SilverStripe\Admin\CMSMenuItem
- CMSPreviewable: SilverStripe\Admin\CMSPreviewable
+ CMSPreviewable: SilverStripe\ORM\CMSPreviewable
CMSProfileController: SilverStripe\Admin\CMSProfileController
GroupImportForm: SilverStripe\Admin\GroupImportForm
LeftAndMain: SilverStripe\Admin\LeftAndMain
diff --git a/composer.json b/composer.json
index 7319fe5cd..5d6f027aa 100644
--- a/composer.json
+++ b/composer.json
@@ -23,7 +23,6 @@
"monolog/monolog": "~1.11",
"nikic/php-parser": "^2 || ^3",
"silverstripe/config": "^1@dev",
- "silverstripe/admin": "^1@dev",
"swiftmailer/swiftmailer": "~5.4",
"symfony/cache": "^3.3@dev",
"symfony/config": "^2.8",
@@ -32,6 +31,7 @@
"vlucas/phpdotenv": "^2.4"
},
"require-dev": {
+ "silverstripe/admin": "^1@dev",
"phpunit/PHPUnit": "~4.8",
"silverstripe/behat-extension": "^2.1.0",
"silverstripe/serve": "dev-master",
diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md
index 313e4e91a..27eacda2e 100644
--- a/docs/en/04_Changelogs/4.0.0.md
+++ b/docs/en/04_Changelogs/4.0.0.md
@@ -52,6 +52,7 @@ guide developers in preparing existing 3.x code for compatibility with 4.0
* i18n Updated to use symfony/translation over zend Framework 1. Zend_Translate has been removed.
* Replaced `Zend_Cache` and the `Cache` API with a PSR-16 implementation (symfony/cache)
* _ss_environment.php files have been removed in favour of `.env` and "real" environment variables.
+* admin has been moved to a new module [silverstripe/admin](https://github.com/silverstripe/silverstripe-admin).
## Upgrading
@@ -1141,6 +1142,7 @@ A very small number of methods were chosen for deprecation, and will be removed
class which can be used to select the correct behaviour:
* `HTMLText`: `DBHTMLText` with shortcodes enabled
* `HTMLFragment`: `DBHTMLText` without shortcodes enabled (as default)
+* `CMSPreviewable` has been moved from the `SilverStripe\Admin` namespace to `SilverStripe\ORM`
* Changes to `DBString` formatting:
* `NoHTML` is renamed to `Plain`
* `LimitWordCountXML` is removed. Use `LimitWordCount` instead.
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index cc1d4b96e..bbff0c2ec 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -20,7 +20,6 @@
tests/php
- admin/tests/php
diff --git a/src/Assets/File.php b/src/Assets/File.php
index a115646e5..1482b6992 100644
--- a/src/Assets/File.php
+++ b/src/Assets/File.php
@@ -2,15 +2,13 @@
namespace SilverStripe\Assets;
-use SilverStripe\Admin\AdminRootController;
-use SilverStripe\Admin\CMSPreviewable;
+use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\Assets\Storage\AssetNameGenerator;
use SilverStripe\Assets\Storage\DBFile;
use SilverStripe\Assets\Storage\AssetContainer;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Convert;
use SilverStripe\Control\Director;
-use SilverStripe\Control\Controller;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\DatetimeField;
@@ -823,21 +821,6 @@ class File extends DataObject implements ShortcodeHandler, AssetContainer, Thumb
return null;
}
- /**
- * @todo Coupling with cms module, remove this method.
- *
- * @return string
- */
- public function DeleteLink()
- {
- return Controller::join_links(
- Director::absoluteBaseURL(),
- AdminRootController::admin_url(),
- "assets/removefile/",
- $this->ID
- );
- }
-
/**
* Get expected value of Filename tuple value. Will be used to trigger
* a file move on draft stage.
diff --git a/src/ORM/CMSPreviewable.php b/src/ORM/CMSPreviewable.php
new file mode 100644
index 000000000..8f5a6d823
--- /dev/null
+++ b/src/ORM/CMSPreviewable.php
@@ -0,0 +1,40 @@
+redirectToExternalLogin();
}
diff --git a/src/Security/Group.php b/src/Security/Group.php
index 288fd6b71..5aaf2478c 100755
--- a/src/Security/Group.php
+++ b/src/Security/Group.php
@@ -144,10 +144,6 @@ class Group extends DataObject
_t('Group.GroupReminder', 'If you choose a parent group, this group will take all it\'s roles')
);
- // Filter permissions
- // TODO SecurityAdmin coupling, not easy to get to the form fields through GridFieldDetailForm
- $permissionsField->setHiddenPermissions((array)Config::inst()->get('SilverStripe\\Admin\\SecurityAdmin', 'hidden_permissions'));
-
if ($this->ID) {
$group = $this;
$config = GridFieldConfig_RelationEditor::create();
@@ -211,7 +207,10 @@ class Group extends DataObject
// Only show the "Roles" tab if permissions are granted to edit them,
// and at least one role exists
- if (Permission::check('APPLY_ROLES') && DataObject::get('SilverStripe\\Security\\PermissionRole')) {
+ if (Permission::check('APPLY_ROLES') &&
+ PermissionRole::get()->count() &&
+ class_exists(SecurityAdmin::class)
+ ) {
$fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.ROLES', 'Roles'));
$fields->addFieldToTab(
'Root.Roles',
diff --git a/src/Security/Member.php b/src/Security/Member.php
index ed217be17..e7090a706 100644
--- a/src/Security/Member.php
+++ b/src/Security/Member.php
@@ -1437,6 +1437,11 @@ class Member extends DataObject implements TemplateGlobalProvider
*/
public static function mapInCMSGroups($groups = null)
{
+ // Check CMS module exists
+ if (!class_exists(LeftAndMain::class)) {
+ return ArrayList::create()->map();
+ }
+
if (!$groups || $groups->Count() == 0) {
$perms = array('ADMIN', 'CMS_ACCESS_AssetAdmin');