BUGFIX #2056: Removed all references to deprecated Member::isAdmin()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65232 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-04 23:31:33 +00:00
parent 72d90ab270
commit 5f177b9f08
6 changed files with 12 additions and 22 deletions

View File

@ -1761,9 +1761,7 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
if(!isset($member)) {
$member = Member::currentUser();
}
if($member && $member->isAdmin()) {
return true;
}
if(Permission::checkMember($member, "ADMIN")) return true;
if($this->many_many('Can' . $perm)) {
if($this->ParentID && $this->SecurityType == 'Inherit') {

View File

@ -62,7 +62,7 @@ class DatabaseAdmin extends Controller {
* Updates the database schema, creating tables & fields as necessary.
*/
function build() {
if(Director::isLive() && Security::database_is_ready() && !Director::is_cli() && (!Member::currentUser() || !Member::currentUser()->isAdmin())) {
if(Director::isLive() && Security::database_is_ready() && !Director::is_cli() && !Permission::check("ADMIN")) {
Security::permissionFailure($this,
"This page is secured and you need administrator rights to access it. " .
"Enter your credentials below and we will send you right along.");

View File

@ -523,9 +523,7 @@ class SiteTree extends DataObject {
if(!isset($member)) {
$member = Member::currentUser();
}
if($member && $member->isAdmin()) {
return true;
}
if(Permission::checkMember($member, "ADMIN")) return true;
if(method_exists($this, 'can' . ucfirst($perm))) {
$method = 'can' . ucfirst($perm);
@ -562,9 +560,7 @@ class SiteTree extends DataObject {
if(!isset($member)) {
$member = Member::currentUser();
}
if($member && $member->isAdmin()) {
return true;
}
if(Permission::checkMember($member, "ADMIN")) return true;
$args = array($member, true);
$this->extend('alternateCanAddChildren', $args);
@ -594,7 +590,7 @@ class SiteTree extends DataObject {
if(!isset($member)) $member = Member::currentUser();
// admin override
if($member && $member->isAdmin()) return true;
if(Permission::checkMember($member, "ADMIN")) return true;
// decorated access checks
$args = array($member, true);
@ -647,7 +643,7 @@ class SiteTree extends DataObject {
public function canDelete($member = null) {
if(!isset($member)) $member = Member::currentUser();
if($member && $member->isAdmin()) return true;
if(Permission::checkMember($member, "ADMIN")) return true;
$args = array($member, true);
$this->extend('alternateCanDelete', $args);
@ -685,7 +681,7 @@ class SiteTree extends DataObject {
public function canCreate($member = null) {
if(!isset($member)) $member = Member::currentUser();
if($member && $member->isAdmin()) return true;
if(Permission::checkMember($member, "ADMIN")) return true;
$args = array($member, true);
$this->extend('alternateCanCreate', $args);

View File

@ -46,8 +46,7 @@ class Folder extends File {
}
function userCanUse() {
if( Member::currentUser()->isAdmin() )
return true;
if(Permission::check("ADMIN")) return true;
$useGroups = $this->CanUse();
@ -62,8 +61,7 @@ class Folder extends File {
}
function userCanEdit() {
if( Member::currentUser()->isAdmin() )
return true;
if(Permission::check("ADMIN")) return true;
$useGroups = $this->CanEdit();

View File

@ -566,13 +566,11 @@ class Member extends DataObject {
* Returns true if this user is an administrator.
* Administrators have access to everything.
*
* @TODO Should this function really exist? Is not {@link isAdmin()} the
* only right name for this?
*
* @deprecated Use Permission::check('ADMIN') instead
* @return Returns TRUE if this user is an administrator.
*/
function isAdmin() {
return Permission::check('ADMIN');
return Permission::checkMember($this, 'ADMIN');
}
//------------------- HELPER METHODS -----------------------------------//

View File

@ -871,7 +871,7 @@ class Security extends Controller {
*/
public function encryptallpasswords() {
// Only administrators can run this method
if(!Member::currentUser() || !Member::currentUser()->isAdmin()) {
if(!Permission::check("ADMIN")) {
Security::permissionFailure($this,
_t('Security.PERMFAILURE',' This page is secured and you need administrator rights to access it.
Enter your credentials below and we will send you right along.'));