class ImagePolicy 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, Image $image)

Determine if the user can access the given image.

bool
addAnnotation(User $user, Image $image)

Determine if the user can add an annotation to given image.

bool
destroy(User $user, Image $image)

Determine if the user can delete the given image.

bool
attachLabel(User $user, Image $image, Label $label)

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

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 25
bool|null before(User $user, string $ability)

Intercept all checks.

Parameters

User $user
string $ability

Return Value

bool|null

at line 39
bool access(User $user, Image $image)

Determine if the user can access the given image.

Parameters

User $user
Image $image

Return Value

bool

at line 63
bool addAnnotation(User $user, Image $image)

Determine if the user can add an annotation to given image.

Parameters

User $user
Image $image

Return Value

bool

at line 91
bool destroy(User $user, Image $image)

Determine if the user can delete the given image.

Parameters

User $user
Image $image

Return Value

bool

at line 120
bool attachLabel(User $user, Image $image, Label $label)

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

The 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 image belong to.

Parameters

User $user
Image $image
Label $label

Return Value

bool