-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c4534b
commit 41f2f7d
Showing
2 changed files
with
89 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/php/Dev/DevAdminControllerTest/ControllerWithPermissions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Dev\Tests\DevAdminControllerTest; | ||
|
||
use SilverStripe\Control\Controller; | ||
use SilverStripe\Security\Permission; | ||
use SilverStripe\Security\PermissionProvider; | ||
|
||
class ControllerWithPermissions extends Controller implements PermissionProvider | ||
{ | ||
|
||
public const OK_MSG = 'DevAdminControllerTest_ControllerWithPermissions TEST OK'; | ||
|
||
private static $url_handlers = [ | ||
'' => 'index', | ||
]; | ||
|
||
private static $allowed_actions = [ | ||
'index', | ||
]; | ||
|
||
|
||
public function index() | ||
{ | ||
echo self::OK_MSG; | ||
} | ||
|
||
public function canInit() | ||
{ | ||
return Permission::check('DEV_ADMIN_TEST_PERMISSION'); | ||
} | ||
|
||
public function providePermissions() | ||
{ | ||
return [ | ||
'DEV_ADMIN_TEST_PERMISSION' => 'Dev admin test permission', | ||
]; | ||
} | ||
} |