Skip to content
Browse files

ENHANCEMENT Removed automatic redirection to admin URLs in ContentCon…

…troller, too counter-intuitive and hard to implement consistently, while still allowing linkage of pages without CMS around them.
  • Loading branch information...
1 parent e13537e commit eecb401952f12cd64422c07909c1ff0477f32841 @chillu chillu committed Jul 21, 2011
View
8 code/controller/ContentController.php
@@ -121,12 +121,6 @@ public function init() {
}
}
- // Redirect to admin UI if user is logged in
- if($this->URLSegment != 'Security' && Permission::check('CMS_ACCESS_CMSMain') && !$this->request->getVar('cms-preview-disabled')) {
- $cmsController = singleton('CMSPageEditController');
- return Director::redirect(Controller::join_links($cmsController->Link('show'), $this->dataRecord->ID, '?cms-preview-expanded=1'));
- }
-
// Use theme from the site config
if(($config = SiteConfig::current_site_config()) && $config->Theme) {
SSViewer::set_theme($config->Theme);
@@ -344,9 +338,7 @@ public function SilverStripeNavigator() {
if(Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if($this->dataRecord) {
Requirements::css(CMS_DIR . '/css/SilverStripeNavigator.css');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-livequery/jquery.livequery.js');
Requirements::javascript(CMS_DIR . '/javascript/SilverStripeNavigator.js');
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
View
6 tests/controller/ContentControllerPermissionsTest.php
@@ -3,7 +3,7 @@
* @package cms
* @subpackage tests
*/
-class ContentControllerPermissionTest extends FunctionalTest {
+class ContentControllerPermissionsTest extends FunctionalTest {
protected $usesDatabase = true;
@@ -29,9 +29,7 @@ public function testCanViewStage() {
$this->logInWithPermission('CMS_ACCESS_CMSMain');
$response = $this->get('/testpage/?stage=Stage');
- $this->assertEquals($response->getStatusCode(), 302, 'Redirects to page view in CMS when logged in for draft stage');
- $this->assertNotContains('Security/login', $response->getHeader('Location'));
- $this->assertContains('admin/page/edit/show/' . $page->ID, $response->getHeader('Location'));
+ $this->assertEquals($response->getStatusCode(), 200, 'Doesnt redirect to login, but shows page for authenticated user');
}
View
2 tests/controller/SilverStripeNavigatorTest.php
@@ -14,7 +14,7 @@ function testGetItems() {
$items = $navigator->getItems();
$classes = array_map('get_class', $items->toArray());
- $this->assertContains('SilverStripeNavigatorItem_LiveLink', $classes,
+ $this->assertContains('SilverStripeNavigatorItem_StageLink', $classes,
'Adds default classes'
);
View
7 tests/model/SiteTreePermissionsTest.php
@@ -62,9 +62,7 @@ function testAccessingStageWithBlankStage() {
$this->assertEquals($response->getStatusCode(), '404');
$response = $this->get($page->URLSegment . '?stage=Stage');
- $this->assertEquals($response->getStatusCode(), '302');
- $this->assertNotContains('Security/login', $response->getHeader('Location'));
- $this->assertContains('admin/page/edit/show/' . $page->ID, $response->getHeader('Location'));
+ $this->assertEquals($response->getStatusCode(), '200');
$response = $this->get($page->URLSegment . '?stage=');
$this->assertEquals($response->getStatusCode(), '404');
@@ -333,10 +331,9 @@ function testRestrictedViewInheritance() {
$response = $this->get($childPage->RelativeLink());
$this->assertEquals(
$response->getStatusCode(),
- 302,
+ 200,
'Authenticated members can view a page marked as "Viewable by these groups" if theyre in the listed groups by inherited permission'
);
- $this->assertContains('admin/page/edit/show/' . $childPage->ID, $response->getHeader('Location'));
$this->session()->inst_set('loggedInAs', null);
}

0 comments on commit eecb401

Please sign in to comment.
Something went wrong with that request. Please try again.