2017-05-11 11:07:27 +02:00
|
|
|
<?php
|
|
|
|
|
2017-09-27 17:43:01 +02:00
|
|
|
namespace SilverStripe\Security\Tests\InheritedPermissionsTest;
|
2017-05-11 11:07:27 +02:00
|
|
|
|
|
|
|
use SilverStripe\Security\Member;
|
|
|
|
use SilverStripe\Security\DefaultPermissionChecker;
|
|
|
|
|
|
|
|
class TestDefaultPermissionChecker implements DefaultPermissionChecker
|
|
|
|
{
|
|
|
|
protected $canEdit = true;
|
|
|
|
|
|
|
|
protected $canView = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can root be edited?
|
|
|
|
*
|
|
|
|
* @param Member $member
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function canEdit(Member $member = null)
|
|
|
|
{
|
|
|
|
return $this->canEdit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can root be viewed?
|
|
|
|
*
|
|
|
|
* @param Member $member
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function canView(Member $member = null)
|
|
|
|
{
|
|
|
|
return $this->canView;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can root be deleted?
|
|
|
|
*
|
|
|
|
* @param Member $member
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function canDelete(Member $member = null)
|
|
|
|
{
|
|
|
|
return $this->canEdit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can root objects be created?
|
|
|
|
*
|
|
|
|
* @param Member $member
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function canCreate(Member $member = null)
|
|
|
|
{
|
|
|
|
return $this->canEdit;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCanEdit($canEdit)
|
|
|
|
{
|
|
|
|
$this->canEdit = $canEdit;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCanView($canView)
|
|
|
|
{
|
|
|
|
$this->canView = $canView;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|