mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\FrameworkTest\Extension;
|
|
|
|
use SilverStripe\Core\Extension;
|
|
use SilverStripe\Security\Permission;
|
|
use SilverStripe\Security\PermissionProvider;
|
|
|
|
class TestDataObjectExtension extends Extension implements PermissionProvider
|
|
{
|
|
public function providePermissions()
|
|
{
|
|
return [
|
|
'TEST_DATAOBJECT_EDIT' => [
|
|
'name' => _t(
|
|
__CLASS__ . '.EditPermissionLabel',
|
|
'Manage a test object'
|
|
),
|
|
'category' => _t(
|
|
__CLASS__ . '.Category',
|
|
'Test Data Object'
|
|
),
|
|
],
|
|
];
|
|
}
|
|
|
|
protected function canView($member = null)
|
|
{
|
|
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member);
|
|
}
|
|
|
|
protected function canEdit($member = null)
|
|
{
|
|
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member);
|
|
}
|
|
|
|
protected function canDelete($member = null)
|
|
{
|
|
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member);
|
|
}
|
|
|
|
protected function canCreate($member = null, $context = [])
|
|
{
|
|
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member);
|
|
}
|
|
}
|