InheritedPermissions
class InheritedPermissions implements PermissionChecker, MemberCacheFlusher (View source)
Calculates batch permissions for nested objects for:
- canView: Supports 'Anyone' type
- canEdit
- canDelete: Includes special logic for ensuring parent objects can only be deleted if their children can be deleted also.
Traits
A class that can be instantiated or replaced via DI
Constants
DELETE |
Delete permission |
VIEW |
View permission |
EDIT |
Edit permission |
ANYONE |
Anyone canView permission |
LOGGED_IN_USERS |
Restrict to logged in users |
ONLY_THESE_USERS |
Restrict to specific groups |
INHERIT |
Inherit from parent |
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Construct new permissions object
Commits the cache
Clear the cache for this instance only
Global permissions required to edit
No description
Get root permissions handler, or null if no handler
Get base class
Force pre-calculation of a list of permissions for optimisation
No description
Details
static Injectable
create(array ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
__construct(string $baseClass, CacheInterface $cache = null)
Construct new permissions object
__destruct()
Commits the cache
flushMemberCache(array $memberIDs = null)
Clear the cache for this instance only
$this
setDefaultPermissions(DefaultPermissionChecker $callback)
$this
setGlobalEditPermissions(array $permissions)
Global permissions required to edit
array
getGlobalEditPermissions()
DefaultPermissionChecker|null
getDefaultPermissions()
Get root permissions handler, or null if no handler
string
getBaseClass()
Get base class
prePopulatePermissionCache(string $permission = 'edit', array $ids = [])
Force pre-calculation of a list of permissions for optimisation