silverstripe-framework/tests/php/Security/InheritedPermissionsTest/TestDefaultPermissionChecker.php
Damian Mooyman 0b70b008b3 API Implement InheritedPermission calculator (#6877)
* API Implement InheritedPermission calculator

* API Rename RootPermissions to DefaultPermissionChecker
API Refactor inherited permission fields into InheritedPermissionExtension
API Introduce PermissionChecker interface
2017-05-11 21:07:27 +12:00

70 lines
1.3 KiB
PHP

<?php
namespace SilverStripe\Security\Test\InheritedPermissionsTest;
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;
}
}