From 9dbdd992f729fe7ddedd5fe9ea4b34ee38135d63 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Sun, 10 Feb 2019 12:10:53 +0300 Subject: [PATCH 1/3] FIX Content editor group users can now insert links into contents while using subsites --- src/Extensions/LeftAndMainSubsites.php | 8 +++-- .../features/insert-content-link.feature | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tests/behat/features/insert-content-link.feature diff --git a/src/Extensions/LeftAndMainSubsites.php b/src/Extensions/LeftAndMainSubsites.php index 760623f..a3dee3d 100644 --- a/src/Extensions/LeftAndMainSubsites.php +++ b/src/Extensions/LeftAndMainSubsites.php @@ -221,9 +221,11 @@ class LeftAndMainSubsites extends LeftAndMainExtension // Admin can access everything, no point in checking. $member = Security::getCurrentUser(); if ($member - && (Permission::checkMember($member, 'ADMIN') // 'Full administrative rights' - || Permission::checkMember($member, 'CMS_ACCESS_LeftAndMain') // 'Access to all CMS sections' - ) + && (Permission::checkMember($member, [ + 'ADMIN', // Full administrative rights + 'CMS_ACCESS_LeftAndMain', // Access to all CMS sections + 'CMS_ACCESS_CMSMain', // Access to CMS controllers + ])) ) { return true; } diff --git a/tests/behat/features/insert-content-link.feature b/tests/behat/features/insert-content-link.feature new file mode 100644 index 0000000..e055202 --- /dev/null +++ b/tests/behat/features/insert-content-link.feature @@ -0,0 +1,29 @@ +# See https://github.com/silverstripe/silverstripe-subsites/issues/357 +Feature: Insert an internal link into content + As a CMS user + I can insert internal links into my content + So that I can direct users to different parts of my website + + Background: + Given a "subsite" "Subsite B" + And a "page" "My page" with "URLSegment"="my-page", "Content"="My page content" + And a "page" "Another page" with "URLSegment"="another-page", "Content"="My other page content" + And I am logged in with "CMS_ACCESS_CMSMain" permissions + Then I go to "admin/pages" + And I click on "My page" in the tree + + @javascript + Scenario: I can insert an internal link + # See "insert-a-link.feature" from silverstripe/cms + When I select "My page" in the "Content" HTML field + And I press the "Insert link" HTML field button + And I click "Page on this site" in the ".mce-menu" element + Then I should see an "form#Form_editorInternalLink" element + When I click "(Choose Page)" in the ".Select-multi-value-wrapper" element + And I click "Another page" in the ".treedropdownfield__menu" element + And I fill in "my desc" for "Link description" + And I press the "Insert" button + Then the "Content" HTML field should contain "" + # Required to avoid "unsaved changes" browser dialog + Then I press the "Save" button From f003fb5e74e577db0fbc34a654516060da6364c8 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Sun, 10 Feb 2019 12:33:52 +0300 Subject: [PATCH 2/3] Add PHP 7.3 to build matrix and move Behat builds to SilverStripe 4.3 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c1453e..459c0b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,11 @@ matrix: - php: 7.0 env: DB=PGSQL INSTALLER_VERSION=4.1.x-dev PHPUNIT_TEST=1 - php: 7.1 - env: DB=MYSQL INSTALLER_VERSION=4.1.x-dev BEHAT_TEST=1 - - php: 7.2 env: DB=MYSQL INSTALLER_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1 - php: 7.2 - env: DB=MYSQL INSTALLER_VERSION=4.x-dev BEHAT_TEST=1 + env: DB=MYSQL INSTALLER_VERSION=4.3.x-dev BEHAT_TEST=1 + - php: 7.3 + env: DB=MYSQL INSTALLER_VERSION=4.x-dev PHPUNIT_TEST=1 before_script: # Extra $PATH From ec327aee7c7d11d26ff4798d44769eb2aa789128 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 15 Apr 2019 16:26:53 +1200 Subject: [PATCH 3/3] Update dependencies for SilverStripe ^4.4 --- .travis.yml | 14 ++++++++------ composer.json | 15 ++++++--------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c1453e..bc41fd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: env: global: - - COMPOSER_ROOT_VERSION="2.0.x-dev" + - COMPOSER_ROOT_VERSION="2.3.x-dev" - DISPLAY=":99" - XVFBARGS=":99 -ac -screen 0 1024x768x16" - SS_BASE_URL="http://localhost:8080/" @@ -17,15 +17,17 @@ env: matrix: include: - php: 5.6 - env: DB=MYSQL INSTALLER_VERSION=4.0.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1 + env: DB=MYSQL INSTALLER_VERSION=4.4.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1 - php: 7.0 - env: DB=PGSQL INSTALLER_VERSION=4.1.x-dev PHPUNIT_TEST=1 + env: DB=PGSQL INSTALLER_VERSION=4.4.x-dev PHPUNIT_TEST=1 - php: 7.1 - env: DB=MYSQL INSTALLER_VERSION=4.1.x-dev BEHAT_TEST=1 + env: DB=MYSQL INSTALLER_VERSION=4.4.x-dev BEHAT_TEST=1 - php: 7.2 - env: DB=MYSQL INSTALLER_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1 + env: DB=MYSQL INSTALLER_VERSION=4.4.x-dev PHPUNIT_COVERAGE_TEST=1 - php: 7.2 env: DB=MYSQL INSTALLER_VERSION=4.x-dev BEHAT_TEST=1 + - php: 7.3 + env: DB=MYSQL INSTALLER_VERSION=4.4.x-dev PHPUNIT_TEST=1 before_script: # Extra $PATH @@ -39,7 +41,7 @@ before_script: # Install composer - composer validate - composer require silverstripe/installer:"$INSTALLER_VERSION" silverstripe/recipe-testing:^1 --no-update - - if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi + - if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.2.x-dev; fi - composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile # Behat bootstrapping diff --git a/composer.json b/composer.json index f3dff6c..fe3c11f 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ } ], "require": { - "silverstripe/framework": "^4", - "silverstripe/cms": "^4", - "silverstripe/admin": "^1", - "silverstripe/asset-admin": "^1", - "silverstripe/errorpage": "^1", - "silverstripe/versioned": "^1" + "silverstripe/framework": "^4.4@dev", + "silverstripe/cms": "^4.4@dev", + "silverstripe/admin": "^1.4@dev", + "silverstripe/asset-admin": "^1.4@dev", + "silverstripe/errorpage": "^1.4@dev", + "silverstripe/versioned": "^1.4@dev" }, "require-dev": { "phpunit/phpunit": "^5.7", @@ -33,9 +33,6 @@ } }, "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "expose": [ "javascript", "css"