mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 10:41:25 +02:00
ENHANCEMENT: Added SITETREE_VIEW_ALL and SITETREE_EDIT_ALL permission code, which provide better performance for editors that can edit everything but who aren't ADMINs.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78630 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
7712c5de49
commit
fb470bc53d
@ -630,7 +630,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
||||||
|
|
||||||
// admin override
|
// admin override
|
||||||
if($member && Permission::checkMember($member, "ADMIN")) return true;
|
if($member && Permission::checkMember($member, array("ADMIN", "SITETREE_VIEW_ALL"))) return true;
|
||||||
|
|
||||||
// DEPRECATED 2.3: use canView() instead
|
// DEPRECATED 2.3: use canView() instead
|
||||||
$results = $this->extend('alternateCanView', $member);
|
$results = $this->extend('alternateCanView', $member);
|
||||||
@ -684,7 +684,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
public function canDelete($member = null) {
|
public function canDelete($member = null) {
|
||||||
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
||||||
|
|
||||||
if($member && Permission::checkMember($member, "ADMIN")) return true;
|
if($member && Permission::checkMember($member, array("ADMIN", "SITETREE_EDIT_ALL"))) return true;
|
||||||
|
|
||||||
// DEPRECATED 2.3: use canDelete() instead
|
// DEPRECATED 2.3: use canDelete() instead
|
||||||
$results = $this->extend('alternateCanDelete', $member);
|
$results = $this->extend('alternateCanDelete', $member);
|
||||||
@ -762,7 +762,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
public function canEdit($member = null) {
|
public function canEdit($member = null) {
|
||||||
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();
|
||||||
|
|
||||||
if($member && Permission::checkMember($member, "ADMIN")) return true;
|
if($member && Permission::checkMember($member, array("ADMIN", "SITETREE_EDIT_ALL"))) return true;
|
||||||
|
|
||||||
// DEPRECATED 2.3: use canEdit() instead
|
// DEPRECATED 2.3: use canEdit() instead
|
||||||
$results = $this->extend('alternateCanEdit', $member);
|
$results = $this->extend('alternateCanEdit', $member);
|
||||||
@ -1905,7 +1905,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
'SITETREE_GRANT_ACCESS' => _t(
|
'SITETREE_GRANT_ACCESS' => _t(
|
||||||
'SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION',
|
'SiteTree.PERMISSION_GRANTACCESS_DESCRIPTION',
|
||||||
'Control which groups can access or edit certain pages'
|
'Control which groups can access or edit certain pages'
|
||||||
)
|
),
|
||||||
|
'SITETREE_VIEW_ALL' => _t(
|
||||||
|
'SiteTree.VIEW_ALL_DESCRIPTION',
|
||||||
|
'Can view any page on the site, regard of the settings on the Access tab'
|
||||||
|
),
|
||||||
|
'SITETREE_EDIT_ALL' => _t(
|
||||||
|
'SiteTree.EDIT_ALL_DESCRIPTION',
|
||||||
|
'Can edit any page on the site, regard of the settings on the Access tab'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user