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
33 lines
886 B
PHP
33 lines
886 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Security;
|
|
|
|
use SilverStripe\ORM\DataExtension;
|
|
use SilverStripe\ORM\ManyManyList;
|
|
|
|
/**
|
|
* Provides standard permission fields for inheritable permissions
|
|
*
|
|
* @property string $CanViewType
|
|
* @property string $CanEditType
|
|
* @method ManyManyList ViewerGroups()
|
|
* @method ManyManyList EditorGroups()
|
|
*/
|
|
class InheritedPermissionsExtension extends DataExtension
|
|
{
|
|
private static $db = [
|
|
'CanViewType' => "Enum('Anyone, LoggedInUsers, OnlyTheseUsers, Inherit', 'Inherit')",
|
|
'CanEditType' => "Enum('LoggedInUsers, OnlyTheseUsers, Inherit', 'Inherit')",
|
|
];
|
|
|
|
private static $many_many = [
|
|
'ViewerGroups' => Group::class,
|
|
'EditorGroups' => Group::class,
|
|
];
|
|
|
|
private static $defaults = [
|
|
'CanViewType' => InheritedPermissions::INHERIT,
|
|
'CanEditType' => InheritedPermissions::INHERIT,
|
|
];
|
|
}
|