class AnnotationPolicy extends CachedPolicy

Traits

HandlesAuthorization

Constants

TIME

Time to store the cached values.

(is irrelevant for the array store)

Properties

protected Cache $cache

The cache instance to use for caching policies.

from  CachedPolicy

Methods

__construct()

Create a new CachedPolicy.

mixed
remember(string $key, callable $callback)

Wrapper for the Cache::remember function of the array cache.

bool|null
before(User $user, string $ability)

Intercept all checks.

bool
access(User $user, Annotation $annotation)

Determine if the user may access the given annotation.

bool
update(User $user, Annotation $annotation)

Determine if the user may update the given annotation.

bool
attachLabel(User $user, Annotation $annotation, Label $label)

Determine if the user can attach the given label to the given annotation.

bool
destroy(User $user, Annotation $annotation)

Determine if the user may delete the given annotation.

string
getFileModelTableName(Annotation $annotation)

Get the file model table name of the annotation.

Details

in CachedPolicy at line 31
__construct()

Create a new CachedPolicy.

in CachedPolicy at line 43
mixed remember(string $key, callable $callback)

Wrapper for the Cache::remember function of the array cache.

Parameters

string $key

Key of the cached item

callable $callback

Callback returning the cached item

Return Value

mixed

at line 27
bool|null before(User $user, string $ability)

Intercept all checks.

Parameters

User $user
string $ability

Return Value

bool|null

at line 43
bool access(User $user, Annotation $annotation)

Determine if the user may access the given annotation.

Parameters

User $user
Annotation $annotation

Return Value

bool

at line 67
bool update(User $user, Annotation $annotation)

Determine if the user may update the given annotation.

Parameters

User $user
Annotation $annotation

Return Value

bool

at line 102
bool attachLabel(User $user, Annotation $annotation, Label $label)

Determine if the user can attach the given label to the given annotation.

The annototation (image) must belong to a project where the user is an editor or admin. The label must belong to a label tree that is used by one of the projects the user and the annotation belong to.

Parameters

User $user
Annotation $annotation
Label $label

Return Value

bool

at line 141
bool destroy(User $user, Annotation $annotation)

Determine if the user may delete the given annotation.

Parameters

User $user
Annotation $annotation

Return Value

bool

at line 190
protected string getFileModelTableName(Annotation $annotation)

Get the file model table name of the annotation.

Parameters

Annotation $annotation

Return Value

string