mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
0b70b008b3
* API Implement InheritedPermission calculator * API Rename RootPermissions to DefaultPermissionChecker API Refactor inherited permission fields into InheritedPermissionExtension API Introduce PermissionChecker interface
70 lines
1.3 KiB
PHP
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;
|
|
}
|
|
}
|