KMP PHP API Reference

RecommendationPolicy extends BasePolicy
in package

Authorization policy for Recommendation entities in the Awards plugin.

Implements state machine management, workflow authorization, and dynamic approval level validation. Supports dynamic canApproveLevel* methods based on award levels.

Tags
see
BasePolicy

Base authorization functionality

https://github.com/Ansteorra/KMP/blob/main/docs/5.2.13-awards-recommendation-policy.md

Full documentation

Table of Contents

Properties

$activeAwardsApprovalWorkflowInstanceIds  : array<string|int, int>|null
Active Awards recommendation approval workflow instance IDs for this request.
$approvalWorkflowInstanceIdsByRecommendation  : array<string, array<string|int, int>>
Approval workflow instance IDs keyed by recommendation ID and status filter.
$pendingRecommendationApprovalByMemberId  : array<int, bool>
Whether a member has active Awards recommendation approval work.
$pendingWorkflowInstanceIdsByMemberId  : array<string, array<string|int, int>>
Pending approval workflow instance IDs keyed by member ID and scoped workflow instances.

Methods

__call()  : bool
Handle dynamic approval authority methods (canApproveLevel*).
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 new recommendations.
canAddNote()  : bool
Check if user can add notes to recommendations.
canAdministerFeedback()  : bool
Check if user can administer recommendation feedback requests.
canDecideApproval()  : bool
Check if the user can respond to the active approval from the recommendation screen.
canDelete()  : bool
Check if $user can delete RolesPermissions
canEdit()  : bool
Check if user can edit a recommendation.
canExport()  : bool
Check if user can export recommendation data.
canGridData()  : bool
Check if $user can view role
canGroup()  : bool
Check if user can group/ungroup recommendations.
canIndex()  : bool
Check if user can access the recommendation list.
canRequestFeedback()  : bool
Check if user can request recommendation feedback.
canRetractFeedback()  : bool
Check if user can retract recommendation feedback requests.
canStartApprovalWorkflow()  : bool
Check if the user can start a new approval workflow from the recommendation screen.
canUpdateStates()  : bool
canView()  : bool
Check if user can view a recommendation.
canViewEventRecommendations()  : bool
Check if user can view recommendations for a specific event.
canViewHidden()  : bool
Check if user can view hidden recommendations.
canViewPrivateNotes()  : bool
Check if user can view private notes on recommendations.
canViewSubmittedByMember()  : bool
Check if user can view recommendations they submitted.
canViewSubmittedForMember()  : bool
Check if user can view recommendations submitted for a specific member.
getDynamicMethods()  : array<string|int, mixed>
Get names of dynamically generated approval methods.
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
_grantSourceIncludesBranch()  : bool
Check whether a matching source grants the requested branch.
_hasPolicy()  : bool
Check if $user can view hidden
_hasPolicyForUrl()  : bool
Check if $user can view hidden
_isSuperUser()  : bool
Check if $user is a super user
_matchesGrantSource()  : bool
Check whether a policy method was granted by a compatible source entity.
canManageRecommendationMember()  : bool
Determine whether the user can manage recommendation actions for a member.
isLockedByBestowal()  : bool
Determine whether a recommendation is locked by a linked bestowal.
activeApprovalWorkflowInstanceIds()  : array<string|int, int>
Return active approval workflow instance IDs for a recommendation.
activeAwardsApprovalWorkflowInstanceIds()  : array<string|int, int>
Return active Awards recommendation approval workflow instance IDs.
approvalWorkflowInstanceIds()  : array<string|int, int>
Return approval workflow instance IDs for a recommendation.
canViewViaApprovalWorkflow()  : bool
Determine workflow-backed read access for current and prior approvers.
canViewViaCurrentApproval()  : bool
Check current approver visibility for an active approval-cycle recommendation.
hasPendingRecommendationApproval()  : bool
Determine whether the member currently has any Awards recommendation approval work.
pendingWorkflowInstanceIdsForMember()  : array<string|int, int>
Get pending approval workflow instance IDs for a member and workflow scope once per policy instance.

Properties

$activeAwardsApprovalWorkflowInstanceIds

Active Awards recommendation approval workflow instance IDs for this request.

private array<string|int, int>|null $activeAwardsApprovalWorkflowInstanceIds = null

$approvalWorkflowInstanceIdsByRecommendation

Approval workflow instance IDs keyed by recommendation ID and status filter.

private array<string, array<string|int, int>> $approvalWorkflowInstanceIdsByRecommendation = []

$pendingRecommendationApprovalByMemberId

Whether a member has active Awards recommendation approval work.

private array<int, bool> $pendingRecommendationApprovalByMemberId = []

$pendingWorkflowInstanceIdsByMemberId

Pending approval workflow instance IDs keyed by member ID and scoped workflow instances.

private array<string, array<string|int, int>> $pendingWorkflowInstanceIdsByMemberId = []

Methods

__call()

Handle dynamic approval authority methods (canApproveLevel*).

public __call(string $name, array<string|int, mixed> $arguments) : bool

Resolves level-specific approval methods dynamically based on award levels.

Parameters
$name : string

The method name (e.g., 'canApproveLevelAoA')

$arguments : array<string|int, mixed>

[$user, $entity, ...args]

Tags
throws
BadMethodCallException

When method is not a recognized dynamic method

Return values
bool

True if user has approval authority for the level

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|null

canAdd()

Check if user can add new recommendations.

public canAdd(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool

Open authorization - any authenticated user can submit recommendations.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation context

$optionalArgs : mixed

Additional authorization context

Return values
bool

Always true for open submission

canAdministerFeedback()

Check if user can administer recommendation feedback requests.

public canAdministerFeedback(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation context

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canDecideApproval()

Check if the user can respond to the active approval from the recommendation screen.

public canDecideApproval(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user.

$entity : BaseEntity

Recommendation entity.

$optionalArgs : mixed

Additional authorization context.

Return values
bool

canEdit()

Check if user can edit a recommendation.

public canEdit(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool

Denies edit when the recommendation is locked to an active bestowal workflow.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canGroup()

Check if user can group/ungroup recommendations.

public canGroup(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool

Delegates to edit permission — same users who can edit can group.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canIndex()

Check if user can access the recommendation list.

public canIndex(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool

Current workflow approvers need list access so the grid can show only the recommendations awaiting their action through the table policy scope.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation context

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canRequestFeedback()

Check if user can request recommendation feedback.

public canRequestFeedback(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation context

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canRetractFeedback()

Check if user can retract recommendation feedback requests.

public canRetractFeedback(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation context

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canStartApprovalWorkflow()

Check if the user can start a new approval workflow from the recommendation screen.

public canStartApprovalWorkflow(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user.

$entity : BaseEntity

Recommendation entity.

$optionalArgs : mixed

Additional authorization context.

Return values
bool

canView()

Check if user can view a recommendation.

public canView(KmpIdentityInterface $user, BaseEntity|Table $entity, mixed ...$optionalArgs) : bool

Current workflow approvers and retained prior approvers receive read-only access.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity|Table

The recommendation entity

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canViewEventRecommendations()

Check if user can view recommendations for a specific event.

public canViewEventRecommendations(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$args) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$args : mixed

Additional authorization context

Return values
bool

True if authorized

canViewPrivateNotes()

Check if user can view private notes on recommendations.

public canViewPrivateNotes(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$optionalArgs) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$optionalArgs : mixed

Additional authorization context

Return values
bool

True if authorized

canViewSubmittedByMember()

Check if user can view recommendations they submitted.

public canViewSubmittedByMember(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$args) : bool

Grants direct access if user is the requester, otherwise delegates to permission check.

Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$args : mixed

Additional authorization context

Return values
bool

True if authorized

canViewSubmittedForMember()

Check if user can view recommendations submitted for a specific member.

public canViewSubmittedForMember(KmpIdentityInterface $user, BaseEntity $entity, mixed ...$args) : bool
Parameters
$user : KmpIdentityInterface

The authenticated user

$entity : BaseEntity

The recommendation entity

$args : mixed

Additional authorization context

Return values
bool

True if authorized

getDynamicMethods()

Get names of dynamically generated approval methods.

public static getDynamicMethods() : array<string|int, mixed>

Returns canApproveLevel* method names based on current award levels.

Return values
array<string|int, mixed>

List of dynamic method names

_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

_grantSourceIncludesBranch()

Check whether a matching source grants the requested branch.

protected _grantSourceIncludesBranch(object $source, int|null $branchId) : bool
Parameters
$source : object

Matching grant source

$branchId : int|null

Branch context for the authorization check

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

_matchesGrantSource()

Check whether a policy method was granted by a compatible source entity.

protected _matchesGrantSource(object $policyMethodData, object $grantSource[, int|null $branchId = null ]) : bool
Parameters
$policyMethodData : object

Policy method authorization data

$grantSource : object

Source entity being checked

$branchId : int|null = null

Branch context for the authorization check

Return values
bool

canManageRecommendationMember()

Determine whether the user can manage recommendation actions for a member.

protected canManageRecommendationMember(KmpIdentityInterface $user, int $memberId) : bool

Allows self or parent-of-minor access.

Parameters
$user : KmpIdentityInterface
$memberId : int
Return values
bool

isLockedByBestowal()

Determine whether a recommendation is locked by a linked bestowal.

protected isLockedByBestowal(BaseEntity $entity) : bool
Parameters
$entity : BaseEntity

Recommendation entity

Return values
bool

activeApprovalWorkflowInstanceIds()

Return active approval workflow instance IDs for a recommendation.

private activeApprovalWorkflowInstanceIds(Recommendation $recommendation) : array<string|int, int>
Parameters
$recommendation : Recommendation

Recommendation entity.

Return values
array<string|int, int>

activeAwardsApprovalWorkflowInstanceIds()

Return active Awards recommendation approval workflow instance IDs.

private activeAwardsApprovalWorkflowInstanceIds() : array<string|int, int>
Return values
array<string|int, int>

approvalWorkflowInstanceIds()

Return approval workflow instance IDs for a recommendation.

private approvalWorkflowInstanceIds(Recommendation $recommendation[, array<string|int, string>|null $statuses = null ]) : array<string|int, int>
Parameters
$recommendation : Recommendation

Recommendation entity.

$statuses : array<string|int, string>|null = null

Optional approval run status filter.

Return values
array<string|int, int>

pendingWorkflowInstanceIdsForMember()

Get pending approval workflow instance IDs for a member and workflow scope once per policy instance.

private pendingWorkflowInstanceIdsForMember(int $memberId[, array<string|int, int>|null $workflowInstanceIds = null ]) : array<string|int, int>
Parameters
$memberId : int

Member ID.

$workflowInstanceIds : array<string|int, int>|null = null

Optional workflow instance scope.

Return values
array<string|int, int>
On this page

Search results