CoolCMS API

AdvertScopeTrait uses trait:short

Module part of the "may the caller see the data of advert X" rule for Comcat (company catalog); mirrors {@see \App\UI\Api\Bazaar\Presenters\Traits\AdvertScopeTrait}.

The only two differences from the Bazaar variant are the scope (comcat.advert.edit) and the manager (Comcat AdvertManager). IMPORTANT: it is a separate file, not a parameter, because swapping the scope is a silent escalation between modules.

Table of Contents

Properties

$advertScopeManager  : AdvertManager

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

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
bool

advertScopeCapability()

protected advertScopeCapability() : string
Return values
string

advertScopePrivilegeKey()

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
string

loadScopedAdvert()

protected loadScopedAdvert(int $advertId) : object|null
Parameters
$advertId : int
Return values
object|null
On this page

Search results