BUGFIX Fixed flaw logic checking for $member variable, since it's always set the alternative for choosing Member::currentUser() would never work.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66638 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-25 08:55:28 +00:00 committed by Sam Minnee
parent a2d5a9ac75
commit 0d450e6c3a

View File

@ -523,7 +523,7 @@ class SiteTree extends DataObject {
* @todo Check we get a endless recursion if we use parent::can()
*/
function can($perm, $member = null) {
if(!isset($member)) $member = Member::currentUser();
if(!$member) $member = Member::currentUser();
if(Permission::checkMember($member, "ADMIN")) return true;
@ -560,7 +560,7 @@ class SiteTree extends DataObject {
* @return boolean True if the current user can add children.
*/
public function canAddChildren($member = null) {
if(!isset($member)) $member = Member::currentUser();
if(!$member) $member = Member::currentUser();
if(Permission::checkMember($member, "ADMIN")) return true;
@ -592,7 +592,7 @@ class SiteTree extends DataObject {
* @return boolean True if the current user can view this page.
*/
public function canView($member = null) {
if(!isset($member)) $member = Member::currentUser();
if(!$member) $member = Member::currentUser();
// admin override
if(Permission::checkMember($member, "ADMIN")) return true;
@ -648,7 +648,7 @@ class SiteTree extends DataObject {
* @return boolean True if the current user can delete this page.
*/
public function canDelete($member = null) {
if(!isset($member)) $member = Member::currentUser();
if(!$member) $member = Member::currentUser();
if(Permission::checkMember($member, "ADMIN")) return true;
@ -690,7 +690,7 @@ class SiteTree extends DataObject {
* @return boolean True if the current user can create pages on this class.
*/
public function canCreate($member = null) {
if(!isset($member)) $member = Member::currentUser();
if(!$member) $member = Member::currentUser();
if(Permission::checkMember($member, "ADMIN")) return true;