2017-05-11 21:07:27 +12:00
|
|
|
<?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
|
|
|
|
{
|
2023-06-12 13:29:06 +12:00
|
|
|
private static array $db = [
|
2017-05-11 21:07:27 +12:00
|
|
|
'CanViewType' => "Enum('Anyone, LoggedInUsers, OnlyTheseUsers, Inherit', 'Inherit')",
|
|
|
|
'CanEditType' => "Enum('LoggedInUsers, OnlyTheseUsers, Inherit', 'Inherit')",
|
|
|
|
];
|
|
|
|
|
2023-06-12 13:29:06 +12:00
|
|
|
private static array $many_many = [
|
2017-05-11 21:07:27 +12:00
|
|
|
'ViewerGroups' => Group::class,
|
|
|
|
'EditorGroups' => Group::class,
|
|
|
|
];
|
|
|
|
|
2023-06-12 13:29:06 +12:00
|
|
|
private static array $defaults = [
|
2017-05-11 21:07:27 +12:00
|
|
|
'CanViewType' => InheritedPermissions::INHERIT,
|
|
|
|
'CanEditType' => InheritedPermissions::INHERIT,
|
|
|
|
];
|
2023-06-12 13:29:06 +12:00
|
|
|
|
|
|
|
private static array $cascade_duplicates = [
|
|
|
|
'ViewerGroups',
|
|
|
|
'EditorGroups',
|
|
|
|
];
|
2017-05-11 21:07:27 +12:00
|
|
|
}
|