AdvertScopeTrait uses trait:short
Bazaar part of the rule "may the caller see the data of advert X".
The rule itself is in AdvertScopeGuardTrait; this trait supplies two module-specific parts:
- the capability scope
bazaar.advert.edit. IMPORTANT: mixing it up with the mirror Comcat scope is a silent defect, because a capability for advert id 5 would unlock company id 5. - the advert loader
AdvertManager::find(), a SELECT by the id from the request; the entity always comes from the database, never from caller data.
The manager is injected with #[Inject] rather than the constructor, because the using
presenters take their own manager there; the property name is unique to avoid collisions.
Table of Contents
Properties
Methods
- advertScopeAllows() : bool
- Returns true when the caller may see the data of advert `$advertId`.
- advertScopeCapability() : string
- advertScopePrivilegeKey() : string
- Privilege key to ask the privileged role about: always `getAll` of this presenter, i.e. "may the caller read this collection without restriction?".
- loadScopedAdvert() : object|null
Properties
$advertScopeManager
public
AdvertManager
$advertScopeManager
Attributes
- #[Inject]
Methods
advertScopeAllows()
Returns true when the caller may see the data of advert `$advertId`.
protected
advertScopeAllows(int|null $advertId) : bool
Fail-closed on every axis: a missing or non-positive id, a nonexistent advert, a
foreign owner and an invalid capability all end in false.
Parameters
- $advertId : int|null
Return values
booladvertScopeCapability()
protected
advertScopeCapability() : string
Return values
stringadvertScopePrivilegeKey()
Privilege key to ask the privileged role about: always `getAll` of this presenter, i.e. "may the caller read this collection without restriction?".
protected
abstract advertScopePrivilegeKey() : string
Return values
stringloadScopedAdvert()
protected
loadScopedAdvert(int $advertId) : object|null
Parameters
- $advertId : int