mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: 2.4 tickets (#4670), new permission code to view draft stage w/o CMS access (from r97895)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102548 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
930b051182
commit
54d166c4ce
@ -115,6 +115,9 @@ class ContentController extends Controller {
|
|||||||
if(!$this->dataRecord->canViewStage(Versioned::current_stage())) {
|
if(!$this->dataRecord->canViewStage(Versioned::current_stage())) {
|
||||||
$link = $this->Link();
|
$link = $this->Link();
|
||||||
$message = _t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", 'You must log in with your CMS password in order to view the draft or archived content. <a href="%s">Click here to go back to the published site.</a>');
|
$message = _t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", 'You must log in with your CMS password in order to view the draft or archived content. <a href="%s">Click here to go back to the published site.</a>');
|
||||||
|
Session::clear('currentStage');
|
||||||
|
Session::clear('archiveDate');
|
||||||
|
|
||||||
return Security::permissionFailure($this, sprintf($message, "$link?stage=Live"));
|
return Security::permissionFailure($this, sprintf($message, "$link?stage=Live"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,7 +290,7 @@ class ContentController extends Controller {
|
|||||||
public function SilverStripeNavigator() {
|
public function SilverStripeNavigator() {
|
||||||
$member = Member::currentUser();
|
$member = Member::currentUser();
|
||||||
|
|
||||||
if(Director::isDev() || Permission::check('CMS_ACCESS_CMSMain')) {
|
if(Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
|
||||||
Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
|
Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css');
|
||||||
|
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
||||||
|
@ -767,7 +767,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
|
|
||||||
if(
|
if(
|
||||||
strtolower($stage) == 'stage' &&
|
strtolower($stage) == 'stage' &&
|
||||||
!Permission::checkMember($member, 'CMS_ACCESS_CMSMain')
|
!(Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT'))
|
||||||
) return false;
|
) return false;
|
||||||
|
|
||||||
return $this->canView($member);
|
return $this->canView($member);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user