diff --git a/security/Group.php b/security/Group.php index 4624b41c0..d43ef21fc 100644 --- a/security/Group.php +++ b/security/Group.php @@ -1,6 +1,7 @@ "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 diff --git a/security/Member.php b/security/Member.php index e6cb9276f..396c2a1da 100644 --- a/security/Member.php +++ b/security/Member.php @@ -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 -----------------------------------//