GatheringWaiverPolicy
extends BasePolicy
in package
GatheringWaiver Entity Authorization Policy
Provides entity-level authorization for gathering waiver operations. Inherits standard CRUD operations from BasePolicy and adds waiver-specific authorization methods.
Stewards (members marked as is_steward=true in gathering_staff) can upload waivers and view pending waivers for gatherings they manage, as long as the gathering has not been closed for waivers.
Tags
Table of Contents
Methods
- before() : bool|null
- Check if $user is a super user and can skip auth with an auto True
- canAdd() : bool
- Check if $user can add RolesPermissions
- canChangeWaiverType() : bool
- Check if user can change waiver type.
- canCloseWaivers() : bool
- Check if user can close waivers.
- canDecline() : bool
- Check if user can decline a waiver.
- canDelete() : bool
- Check if $user can delete RolesPermissions
- canDownload() : bool
- Check if user can download.
- canEdit() : bool
- Check if $user can edit RolesPermissions
- canExport() : bool
- canGridData() : bool
- Check if $user can view role
- canIndex() : bool
- Check if $user can view role
- canInlinePdf() : bool
- Authorize inline PDF viewing for a waiver.
- canNeedingWaivers() : bool
- Check if user can needing waivers.
- canPreview() : bool
- Check if user can preview.
- canUploadWaivers() : bool
- Check if user can upload waivers.
- canView() : bool
- Check if $user can view RolesPermissions
- canViewGatheringWaivers() : bool
- Check if user can view gathering waivers.
- canViewPrivateNotes() : bool
- Check if $user can view hidden
- scopeIndex() : mixed
- Apply scope for index action.
- _getBranchIdsForPolicy() : array<string|int, mixed>|null
- Check if $user can view hidden
- _getPermissions() : bool
- Check if $user can view hidden
- _getPolicies() : bool
- Check if $user can view hidden
- _hasPolicy() : bool
- Check if $user can view hidden
- _hasPolicyForUrl() : bool
- Check if $user can view hidden
- _isGatheringStewardForWaiver() : bool
- Check if user is a steward for the gathering associated with this waiver
- _isSuperUser() : bool
- Check if $user is a super user
Methods
before()
Check if $user is a super user and can skip auth with an auto True
public
before(KmpIdentityInterface $user, mixed $resource, string $action) : bool|null
Parameters
- $user : KmpIdentityInterface
-
The user.
- $resource : mixed
-
The resource.
- $action : string
-
The action.
Return values
bool|nullcanAdd()
Check if $user can add RolesPermissions
public
canAdd(KmpIdentityInterface $user, Table $table, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $table : Table
- $optionalArgs : mixed
Return values
boolcanChangeWaiverType()
Check if user can change waiver type.
public
canChangeWaiverType(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanCloseWaivers()
Check if user can close waivers.
public
canCloseWaivers(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanDecline()
Check if user can decline a waiver.
public
canDecline(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Business rules (30-day limit, not already declined) are checked in the controller.
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanDelete()
Check if $user can delete RolesPermissions
public
canDelete(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanDownload()
Check if user can download.
public
canDownload(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanEdit()
Check if $user can edit RolesPermissions
public
canEdit(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanExport()
public
canExport(KmpIdentityInterface $user, Table $table, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $table : Table
- $optionalArgs : mixed
Return values
boolcanGridData()
Check if $user can view role
public
canGridData(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanIndex()
Check if $user can view role
public
canIndex(KmpIdentityInterface $user, Table $table, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $table : Table
- $optionalArgs : mixed
Return values
boolcanInlinePdf()
Authorize inline PDF viewing for a waiver.
public
canInlinePdf(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
@param \App\KMP\KmpIdentityInterface $user The current user.
@param \App\Model\Entity\BaseEntity $entity The waiver entity.
@param mixed ...$optionalArgs Optional arguments.
@return bool True when authorized.
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanNeedingWaivers()
Check if user can needing waivers.
public
canNeedingWaivers(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanPreview()
Check if user can preview.
public
canPreview(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanUploadWaivers()
Check if user can upload waivers.
public
canUploadWaivers(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanView()
Check if $user can view RolesPermissions
public
canView(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $entity : BaseEntity|Table
- $optionalArgs : mixed
Return values
boolcanViewGatheringWaivers()
Check if user can view gathering waivers.
public
canViewGatheringWaivers(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
- $user : KmpIdentityInterface
- $entity : BaseEntity
- $optionalArgs : mixed
Return values
boolcanViewPrivateNotes()
Check if $user can view hidden
public
canViewPrivateNotes(KmpIdentityInterface $user, BaseEntity $entity) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $entity : BaseEntity
Return values
boolscopeIndex()
Apply scope for index action.
public
scopeIndex(KmpIdentityInterface $user, mixed $query) : mixed
Parameters
- $user : KmpIdentityInterface
- $query : mixed
_getBranchIdsForPolicy()
Check if $user can view hidden
protected
_getBranchIdsForPolicy(KmpIdentityInterface $user, string $policyMethod) : array<string|int, mixed>|null
Parameters
- $user : KmpIdentityInterface
-
The user.
- $policyMethod : string
Return values
array<string|int, mixed>|null_getPermissions()
Check if $user can view hidden
protected
_getPermissions(KmpIdentityInterface $user) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
Return values
bool_getPolicies()
Check if $user can view hidden
protected
_getPolicies(KmpIdentityInterface $user) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
Return values
bool_hasPolicy()
Check if $user can view hidden
protected
_hasPolicy(KmpIdentityInterface $user, string $policyMethod, BaseEntity|Table $entity[, int|null $branchId = null ][, mixed $grantSource = null ]) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $policyMethod : string
- $entity : BaseEntity|Table
- $branchId : int|null = null
- $grantSource : mixed = null
Return values
bool_hasPolicyForUrl()
Check if $user can view hidden
protected
_hasPolicyForUrl(KmpIdentityInterface $user, string $policyMethod, array<string|int, mixed> $urlProps[, int|null $branchId = null ][, mixed $grantSource = null ]) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.
- $policyMethod : string
- $urlProps : array<string|int, mixed>
- $branchId : int|null = null
- $grantSource : mixed = null
Return values
bool_isGatheringStewardForWaiver()
Check if user is a steward for the gathering associated with this waiver
protected
_isGatheringStewardForWaiver(KmpIdentityInterface $user, BaseEntity $entity[, bool $checkClosure = false ]) : bool
Stewards are members assigned to a gathering's staff with is_steward=true. They can upload waivers and see pending waivers for their gatherings.
If no gathering is specified (empty entity), checks if user is a steward for ANY non-closed gathering.
Parameters
- $user : KmpIdentityInterface
-
The user
- $entity : BaseEntity
-
The GatheringWaiver entity (must have gathering or gathering_id)
- $checkClosure : bool = false
-
If true, also verify the gathering is not closed for waivers
Return values
bool —True if user is a steward for this gathering (or any non-closed gathering if no specific gathering)
_isSuperUser()
Check if $user is a super user
protected
_isSuperUser(KmpIdentityInterface $user) : bool
Parameters
- $user : KmpIdentityInterface
-
The user.