Commit Graph

52 Commits

Author SHA1 Message Date
Robbie Averill
65f85faff6 FIX Catch database exceptions in middleware when DB is not ready, set session ID after delegation 2017-09-05 12:07:49 +12:00
Robbie Averill
1ac6e78bb3 FIX Remove session coupling, leave it to middleware. Use state instead. 2017-09-04 11:45:21 +12:00
Robbie Averill
b0087b9035 FIX Allow persisted subsite IDs to session from state, fix remaining unit tests 2017-08-30 15:29:13 +12:00
Robbie Averill
c620ff02f4 FIX LeftAndMain references to owner class, replace Member::currentUser usage 2017-08-30 12:04:43 +12:00
Robbie Averill
e129cafa94 NEW Add SubsiteState and initialisation middleware, replace Subsite::currentSubsiteID use 2017-08-30 11:47:11 +12:00
Robbie Averill
8d8ee14cc2 FIX Run SS standard PHP linter, separate SiteTree test mock classes 2017-08-29 17:43:28 +12:00
Garion Herman
9a289a2e17 Merge branch 'master' into fix-ss-4-master 2017-08-28 21:52:32 +12:00
Garion Herman
5ec1c94410 Bring session / validation calls in line with SS4b1 API, replace icon. 2017-07-25 14:25:58 +12:00
Garion Herman
1975861aec Fix Duplicate to Subsite functionality. 2017-06-04 15:05:59 +12:00
Garion Herman
21a8c56217 Adapt SubsiteXHRController to LeftAndMain API changes. 2017-06-04 14:30:51 +12:00
Werner M. Krauß
55c7240425 fixing code analysis: simplify if statements 2017-06-01 15:56:28 +02:00
Werner M. Krauß
9673c881c1 fixing code analysis: simplify if-return statements 2017-06-01 15:48:01 +02:00
Werner M. Krauß
25754e1158 fixing code analysis: updating phpdoc 2017-06-01 15:32:45 +02:00
Werner M. Krauß
17010f39a3 fixing code analysis: removing unneeded else statements 2017-06-01 15:32:44 +02:00
Werner M. Krauß
4fc13b19f7 fixing code analysis: removing unnecessary parenthesis 2017-06-01 15:32:36 +02:00
Werner M. Krauß
e7ad086641 fixing code analysis: safely use single quotes 2017-06-01 15:32:30 +02:00
Werner M. Krauß
76852594a8 fixing code analysis: public method and case mismatch 2017-06-01 15:31:30 +02:00
Tim Kung
5d3af16aaf - namespacing all classes
- moving all phpunit tests into tests/php
- moving all extensions from _config.php into config.yml and removing obsolete _config.php
- moving GridFieldSubsiteDetailForm_ItemRequest into own file

(cherry picked from commit ee02828)
2017-05-30 15:13:40 +02:00
Werner M. Krauß
9862cf5ea6 merge ss4 fixes by cheddam 2017-05-29 13:42:42 +02:00
Werner M. Krauß
c5f507b3f9 reformat code and tests 2017-05-24 15:26:28 +02:00
Werner M. Krauß
e33a5b4cae upgrader: upgrade code 2017-05-24 13:36:04 +02:00
Werner M. Krauß
2c84e627db upgrader: namespacing classes 2017-05-24 12:32:05 +02:00
Loz Calver
e8f5f58bb0 SS4 namespaces compatibility 2016-09-23 09:34:23 +01:00
Will Rossiter
c8f6f4a588 NEW: Add IncludeChildren option for copying pages between subsites. 2016-07-18 16:41:38 +12:00
Damian Mooyman
a0ede56c0e Reformat for psr-2 2015-11-23 16:53:45 +13:00
Damian Mooyman
e6c8dff7be Merge remote-tracking branch 'origin/1.0'
Conflicts:
	.travis.yml
	code/extensions/LeftAndMainSubsites.php
	composer.json
2015-02-24 09:12:38 +13:00
John Milmine
91591a3752 redirect_fix_between_CMS_sections
previously if you were editing settings and you changed subsites ti would revert you to /admin, now it stays within your current controller
2014-11-24 15:32:05 +13:00
James Cocker
498d6e0619 Fixes #135: LeftAndMain switching between subsites
When trying to switch to a different subsite from a page's editing view, it wouldn't switch. This was partly due to a $record always existing due to the homepage fallback on currentPageID : https://github.com/silverstripe/silverstripe-cms/blob/3.1/code/controllers/CMSMain.php#L816

So as currentPage() couldn't actually be used to test for the existance of a current page, I've added in a check for isset($this->owner->urlParams['ID']).

I've also moved the check for $_GET['SubsiteID’] which indicated a forced subsite switch (eg. via the dropdown switcher) above the check for a current page, as it should take precedence, and it wasn't being run when both conditions matched causing the subsite not to change.

Tested changing subsites from /admin/pages, from page edit view, from a page edit URL, and from other CMS sections such as Files and Security, and all seems to be working perfectly now.
2014-11-24 15:25:53 +13:00
James Cocker
47df87f62c Fixes #135: LeftAndMain switching between subsites
When trying to switch to a different subsite from a page's editing view, it wouldn't switch. This was partly due to a $record always existing due to the homepage fallback on currentPageID : https://github.com/silverstripe/silverstripe-cms/blob/3.1/code/controllers/CMSMain.php#L816

So as currentPage() couldn't actually be used to test for the existance of a current page, I've added in a check for isset($this->owner->urlParams['ID']).

I've also moved the check for $_GET['SubsiteID’] which indicated a forced subsite switch (eg. via the dropdown switcher) above the check for a current page, as it should take precedence, and it wasn't being run when both conditions matched causing the subsite not to change.

Tested changing subsites from /admin/pages, from page edit view, from a page edit URL, and from other CMS sections such as Files and Security, and all seems to be working perfectly now.
2014-06-04 16:41:28 +01:00
Matt Peel
083194857e Allow ‘ADMIN’ and ‘CMS_ACCESS_LeftAndMain’ access to CMS. Fixes CWPBUG-113.
Previously, only the global ‘ADMIN’ permission was allowing users to bypass the
stricter Permission check. We also need to allow the ‘CMS_ACCESS_LeftAndMain’
permission to bypass this check, as otherwise a user who is in a Group with the
‘Access to all CMS sections’ permission set (which only sets the
CMS_ACCESS_LeftAndMain permission code and no others) would be denied access to
the CMS for that sub site.
2014-01-09 17:12:47 +13:00
Mateusz Uzdowski
58b926af25 BUG Refactor the access checks and initial subsite redirections.
Remove the special AJAX handling to simplify the code. Now redirection
will be forced on any request that changes the subsite to re-synchronise
with the frontend.

Introduce canAccess method, and add it to alternateAccessCheck to make
sure this subsite-specific chceck is also done in situations that are
not captured by onBeforeInit.
2013-12-04 17:34:27 +13:00
Mateusz Uzdowski
aacaee08cd BUG Prevent session-interface mismatch.
Disables transparent subsite switch on AJAX requests.

Makes sure the subsite is appropriately set up when opening up the CMS
with a link to subsited object.
2013-11-08 11:37:10 +13:00
Ingo Schommer
5ff3b691d7 More globalisation 2013-10-30 13:44:06 +01:00
Ingo Schommer
7c100f90d2 Merge pull request #115 from mateusz/admin-access
Fix CMS Admin access issues
2013-10-23 01:34:30 +02:00
Mateusz Uzdowski
5b00ba352f API Refactor to always redirect to accessible Admin location.
Tries to find an accessible section in the current site, falls back to
searching across all sites and all sections.

Also adds more powerful and generic functionss:
Subsites::all_sites - get the full list
Subsites::all_accessible_sites - get Member accessible list
LeftAndMainExtension::sectionSites - get section-specific list
2013-10-16 16:40:20 +13:00
Naomi Guyer
37843f447e API: Subsite support for menu of cms (hide admins that don't declare support) (fixes #101 and #89 )
* Hide admins without subsite support from subsites menu
* Add subsite support to default site areas
* Enable reloading of subsites switcher dropdown when navigating the
site, and when editing subsite areas

API Fix parallel pjax menu fetching for subsites.
- thanks Mateusz!

Delint LeftAndMain_Subsites.js
2013-08-22 13:02:46 +12:00
Frank Mullenger
7bf6e89320 BUGFIX: Session var for active subsite out of sync with current subsite. Refs silverstripe/silverstripe-subsites#93. 2013-07-10 12:24:42 +02:00
Sean Harvey
f35a42ec64 BUG LeftAndMainSubsites::Subsites() fails with limited CMS access
Users with non-ADMIN permissions won't see the dropdown of available
subsites, because LeftAndMainSubsites::Subsites() will check if
the user has a non-existent code CMS_ACCESS_CMSPagesController.

Fallback to checking required_permission_codes first, and failing
that, check for CMS_ACCESS_LeftAndMain
2013-05-08 15:36:18 +12:00
Sean Harvey
8ffeeb1ee6 Fixing declaration of statics to private for 3.1+ compatibility 2013-05-06 22:21:09 +12:00
Sean Harvey
3275f4768c Removing underscore from "Default site" text 2013-05-06 22:04:42 +12:00
Naomi Guyer
1a8122ea89 Style site selector dropdown
Made dropdown receive chzn, and applied a dark style to the dropdown to
match the ui of the cms
2013-05-01 17:04:41 +12:00
Morven Lewis-Everley
5747704c97 Make LeftAndMain redirect direct to admin
Currently, using the Subsites dropdown in the admin interface causes the CMS to reload to admin/pages. This can cause issues if you have set another interface as your default (other than CMSMain).
2013-04-25 19:29:56 +02:00
Ingo Schommer
82f1d980e8 Merge remote-tracking branch 'origin/0.3'
Conflicts:
	code/SubsiteAdmin.php
	code/extensions/LeftAndMainSubsites.php
	code/extensions/SiteTreeSubsites.php
	code/model/Subsite.php
	composer.json
	javascript/SubsitesTreeDropdownField.js
	lang/en_US.php
	tests/SubsiteAdminTest.php
	tests/SubsiteTest.php
	tests/SubsiteTest.yml
	tests/SubsitesVirtualPageTest.php
2013-01-03 21:03:26 +01:00
Mateusz Uzdowski
2488489e22 BUG Switch the subsite on GET parameter only.
This fixes the bug where creating the top level pages is broken whenever
subsites module is installed. This is because the SubsiteID is
explicitly specified on AddForm POST submission, which incorrectly
triggers a redirect from LeftAndMainSubsites::init and the form action
never has a chance to execute.

Also do not look at POST when checking for the current subsite ID.
2012-10-26 11:53:40 +13:00
Sean Harvey
d4faeac98f Merge branch 'master' of git://github.com/halkyon/silverstripe-subsites into halkyon-master 2012-10-12 15:09:38 +13:00
Sean Harvey
5e1906c9f4 BUG Fixing use of FormResponse, use X-Status header instead 2012-10-12 12:06:09 +13:00
Sean Harvey
6747ba65bb Fixing LeftAndMainSubsites using deprecated Director::redirect() 2012-10-12 11:06:23 +13:00
Sean Harvey
19a904d1d2 LeftAndMainSubsites failover if map() returns an array instead of an SS_Map 2012-10-12 11:05:00 +13:00
Sean Harvey
070eaf54ae Fixing deprecated call to Director::redirect() 2012-10-11 15:16:38 +13:00
UndefinedOffset
ef4d539a12 BUG: Merged patch from kmayo how ever re-added some of the removed fields since they really should appear on the Main Content tab instead of the Metadata tab.
Fixed a few missed strict errors

Applied patch from kmayo to fix issues with SubsiteAdminTest.php

Fixed issue causing the url segments of subsites created from a template to add -2 to the end

Fixed undefined method TotalItems() on datalist for the SubsiteTest

Fixed failure on SubsiteTest because DataObject::get_one() now returns boolean false instead of null when no result is found

Fixed failure on SubsitesVirtualPageTest caused by Versioned::get_one_by_stage() returning null instead of false

Fixed failure caused by the contact-us page existing on subsite 2

Merged another patch from kmayo

Force main site to be on, for some reason it gets hidden in some cases i.e. refreshing the cms while editing a page
2012-07-16 11:21:54 +12:00