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:
Ingo Schommer 2010-04-13 01:33:49 +00:00
parent 930b051182
commit 54d166c4ce
2 changed files with 5 additions and 2 deletions

View File

@ -115,6 +115,9 @@ class ContentController extends Controller {
if(!$this->dataRecord->canViewStage(Versioned::current_stage())) {
$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>');
Session::clear('currentStage');
Session::clear('archiveDate');
return Security::permissionFailure($this, sprintf($message, "$link?stage=Live"));
}
}
@ -287,7 +290,7 @@ class ContentController extends Controller {
public function SilverStripeNavigator() {
$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::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');

View File

@ -767,7 +767,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if(
strtolower($stage) == 'stage' &&
!Permission::checkMember($member, 'CMS_ACCESS_CMSMain')
!(Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT'))
) return false;
return $this->canView($member);