API CHANGE Removed references to CanCMS and CanCMSAdmin in Group, including references to it in Member. See ticket #2959 for more details.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64327 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-10-16 00:49:51 +00:00
parent 2c384e732f
commit 461b57a647
2 changed files with 14 additions and 48 deletions

View File

@ -1,6 +1,7 @@
<?php
/**
* A security group.
*
* @package sapphire
* @subpackage security
*/
@ -10,18 +11,19 @@ class Group extends DataObject {
"Title" => "Varchar",
"Description" => "Text",
"Code" => "Varchar",
"CanCMS" => "Boolean",
"CanCMSAdmin" => "Boolean",
"Locked" => "Boolean",
"Sort" => "Int",
"IPRestrictions" => "Text",
);
static $has_one = array(
"Parent" => "SiteTree",
);
static $has_many = array(
"Permissions" => "Permission",
);
static $many_many = array(
"Members" => "Member",
);
@ -108,10 +110,6 @@ class Group extends DataObject {
return $fields;
}
static function getAdminGroups() {
return DataObject::get('Group',"CanCMSAdmin=1");
}
/**
* Add a member to a group.
*
@ -128,6 +126,8 @@ class Group extends DataObject {
/**
* Overloaded getter.
*
* @TODO Where is this used, why is this overloaded?
*
* @param $limit string SQL
* @param $offset int

View File

@ -27,16 +27,16 @@ class Member extends DataObject {
static $belongs_many_many = array(
"Groups" => "Group",
);
static $has_one = array();
static $has_many = array(
'UnsubscribedRecords' => 'Member_UnsubscribeRecord'
);
static $has_one = array();
static $many_many = array();
static $many_many_extraFields = array();
static $default_sort = "Surname, FirstName";
@ -46,7 +46,6 @@ class Member extends DataObject {
'AutoLoginHash' => 'unique (AutoLoginHash)'
);
static $notify_password_change = false;
/**
@ -70,15 +69,13 @@ class Member extends DataObject {
'FirstName',
'Surname',
'Email',
);
);
/**
* {@link PasswordValidator} object for validating user's password
*/
protected static $password_validator = null;
/**
* The number of days that a password should be valid for.
* By default, this is null, which means that passwords never expire
@ -105,7 +102,6 @@ class Member extends DataObject {
"'), 'none')";
}
/**
* Check if the passed password matches the stored one
*
@ -213,7 +209,6 @@ class Member extends DataObject {
$this->extend('memberLoggedIn');
}
/**
* Log the user in if the "remember login" cookie is set
*
@ -248,7 +243,6 @@ class Member extends DataObject {
}
}
/**
* Logs this member out.
*/
@ -291,7 +285,6 @@ class Member extends DataObject {
$this->write();
}
/**
* Return the member for the auto login hash
*
@ -632,43 +625,16 @@ class Member extends DataObject {
/**
* Returns true if this user is an administrator.
* Administrators have access to everything. The lucky bastards! ;-)
* Administrators have access to everything.
*
* @TODO Should this function really exist? Is not {@link isAdmin()} the
* only right name for this?
*
* @return Returns TRUE if this user is an administrator.
* @todo Should this function really exists? Is not {@link isAdmin()} the
* only right name for this?
* @todo Is {@link Group}::CanCMSAdmin not deprecated?
*/
function isAdmin() {
if($groups = $this->Groups()) {
foreach($groups as $group) {
if($group->CanCMSAdmin)
return true;
}
}
return Permission::check('ADMIN');
}
function _isAdmin() {
user_error("Deprecated. Use isAdmin() instead", E_USER_NOTICE);
return $this->isAdmin();
}
function isCMSUser() {
if($groups = $this->Groups()) {
foreach($groups as $group) {
if($group->CanCMS)
return true;
}
}
}
function _isCMSUser() {
user_error("Deprecated. Use isCMSUser() instead", E_USER_NOTICE);
return $this->isCMSUser();
}
//------------------- HELPER METHODS -----------------------------------//