silverstripe-framework/src/Security/InheritedPermissionsExtension.php
Guy Sartorelli 357ed7ad7e
ENH Add generic types (#11108)
There are also a few general corrections to PHPDocs that I noticed along
the way (e.g. adding `|null` when the method is returning a null value.

There are some cases where either the return type or the whole PHPDoc
was duplicated from the parent class - in those cases I've simply
removed the duplication.
2024-01-17 17:08:26 +13:00

46 lines
1.3 KiB
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<Group> EditorGroups()
* @method ManyManyList<Member> EditorMembers()
* @method ManyManyList<Group> ViewerGroups()
* @method ManyManyList<Member> ViewerMembers()
*
* @extends DataExtension<DataObject>
*/
class InheritedPermissionsExtension extends DataExtension
{
private static array $db = [
'CanViewType' => "Enum('Anyone, LoggedInUsers, OnlyTheseUsers, OnlyTheseMembers, Inherit', 'Inherit')",
'CanEditType' => "Enum('LoggedInUsers, OnlyTheseUsers, OnlyTheseMembers, Inherit', 'Inherit')",
];
private static array $many_many = [
'ViewerGroups' => Group::class,
'EditorGroups' => Group::class,
'ViewerMembers' => Member::class,
'EditorMembers' => Member::class,
];
private static array $defaults = [
'CanViewType' => InheritedPermissions::INHERIT,
'CanEditType' => InheritedPermissions::INHERIT,
];
private static array $cascade_duplicates = [
'ViewerGroups',
'EditorGroups',
'ViewerMembers',
'EditorMembers',
];
}