-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from creative-commoners/pulls/4/review-behat-…
…tests ENH Extracting logic for canX from Company and Employee
- Loading branch information
Showing
3 changed files
with
54 additions
and
39 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
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
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,46 @@ | ||
<?php | ||
|
||
namespace SilverStripe\FrameworkTest\Extension; | ||
|
||
use SilverStripe\ORM\DataExtension; | ||
use SilverStripe\Security\Permission; | ||
use SilverStripe\Security\PermissionProvider; | ||
|
||
class TestDataObjectExtension extends DataExtension implements PermissionProvider | ||
{ | ||
public function providePermissions() | ||
{ | ||
return [ | ||
'TEST_DATAOBJECT_EDIT' => [ | ||
'name' => _t( | ||
__CLASS__ . '.EditPermissionLabel', | ||
'Manage a test object' | ||
), | ||
'category' => _t( | ||
__CLASS__ . '.Category', | ||
'Test Data Object' | ||
), | ||
], | ||
]; | ||
} | ||
|
||
public function canView($member = null) | ||
{ | ||
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); | ||
} | ||
|
||
public function canEdit($member = null) | ||
{ | ||
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); | ||
} | ||
|
||
public function canDelete($member = null) | ||
{ | ||
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); | ||
} | ||
|
||
public function canCreate($member = null, $context = []) | ||
{ | ||
return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); | ||
} | ||
} |