Authorization
extends ActiveWindowBaseEntity
in package
Authorization Entity
Represents a member's authorization to participate in a specific activity. Extends ActiveWindowBaseEntity for automatic temporal lifecycle management. Tracks approval workflow state, expiration dates, and role assignments.
Status Constants: APPROVED_STATUS, PENDING_STATUS, DENIED_STATUS, REVOKED_STATUS, EXPIRED_STATUS, RETRACTED_STATUS
Database Fields:
- member_id, activity_id, expires_on, start_on, status, approval_count
- granted_member_role_id, revoker_id, revoked_reason, is_renewal
Relationships:
- belongsTo Member, Activity, MemberRole (granted_member_role_id)
- belongsTo RevokedBy (revoker_id) - who revoked
- hasMany AuthorizationApprovals - workflow tracking
Tags
Table of Contents
Constants
- APPROVED_STATUS = "Approved"
- CANCELLED_STATUS = 'Cancelled'
- CURRENT_STATUS = 'Current'
- DEACTIVATED_STATUS = 'Deactivated'
- DENIED_STATUS = "Denied"
- EXPIRED_STATUS = "Expired"
- PENDING_STATUS = "Pending"
- RELEASED_STATUS = 'Released'
- REPLACED_STATUS = 'Replaced'
- RETRACTED_STATUS = "Retracted"
- REVOKED_STATUS = "Revoked"
- UPCOMING_STATUS = 'Upcoming'
Properties
- $activity : Activity
- $activity_id : int
- $approval_count : int
- $authorization_approvals : array<string|int, AuthorizationApproval>
- $branch_id : int|null
- $created : DateTime
- $expires_on : DateTime|null
- $granted_member_role_id : int|null
- $id : int
- $is_renewal : bool
- $member : Member
- $member_id : int
- $member_role : MemberRole
- $modified : DateTime|null
- $revoked_by : Member
- $revoked_reason : string
- $revoker_id : int|null
- $start_on : DateTime|null
- $status : string
- $typeIdField : array<string|int, mixed>
- $_accessible : array<string, bool>
- Fields that can be mass assigned using newEntity() or patchEntity().
Methods
- expire() : bool
- Stops an active window for an entity - save your entity after calling
- getBranchId() : int|null
- Get the branch ID for authorization checks.
- start() : bool
- Starts an active window for an entity - save your entity after calling
- _getExpiresOnToString() : mixed
- Get the expires on to string virtual field.
- _getStartOnToString() : mixed
- Get the start on to string virtual field.
Constants
APPROVED_STATUS
public
mixed
APPROVED_STATUS
= "Approved"
CANCELLED_STATUS
public
mixed
CANCELLED_STATUS
= 'Cancelled'
CURRENT_STATUS
public
mixed
CURRENT_STATUS
= 'Current'
DEACTIVATED_STATUS
public
mixed
DEACTIVATED_STATUS
= 'Deactivated'
DENIED_STATUS
public
mixed
DENIED_STATUS
= "Denied"
EXPIRED_STATUS
public
mixed
EXPIRED_STATUS
= "Expired"
PENDING_STATUS
public
mixed
PENDING_STATUS
= "Pending"
RELEASED_STATUS
public
mixed
RELEASED_STATUS
= 'Released'
REPLACED_STATUS
public
mixed
REPLACED_STATUS
= 'Replaced'
RETRACTED_STATUS
public
mixed
RETRACTED_STATUS
= "Retracted"
REVOKED_STATUS
public
mixed
REVOKED_STATUS
= "Revoked"
UPCOMING_STATUS
public
mixed
UPCOMING_STATUS
= 'Upcoming'
Properties
$activity
public
Activity
$activity
$activity_id
public
int
$activity_id
$approval_count
public
int
$approval_count
$authorization_approvals
public
array<string|int, AuthorizationApproval>
$authorization_approvals
$branch_id
public
int|null
$branch_id
Associated branch ID (when applicable)
$created
public
DateTime
$created
$expires_on
public
DateTime|null
$expires_on
$granted_member_role_id
public
int|null
$granted_member_role_id
$id
public
int
$id
$is_renewal
public
bool
$is_renewal
$member
public
Member
$member
$member_id
public
int
$member_id
$member_role
public
MemberRole
$member_role
$modified
public
DateTime|null
$modified
Last modification timestamp
$revoked_by
public
Member
$revoked_by
$revoked_reason
public
string
$revoked_reason
$revoker_id
public
int|null
$revoker_id
$start_on
public
DateTime|null
$start_on
$status
public
string
$status
$typeIdField
public
array<string|int, mixed>
$typeIdField
= ['activity_id', 'member_id']
$_accessible
Fields that can be mass assigned using newEntity() or patchEntity().
protected
array<string, bool>
$_accessible
= ["member_id" => true, "activity_id" => true, "expires_on" => true, "start_on" => true, "member" => true, "activity" => true, "authorization_approvals" => true]
Note that when '' is set to true, this allows all unspecified fields to be mass assigned. For security purposes, it is advised to set '' to false (or remove it), and explicitly make individual fields accessible as needed.
Methods
expire()
Stops an active window for an entity - save your entity after calling
public
expire([Datetime $expiresOn = null ]) : bool
Parameters
- $expiresOn : Datetime = null
Return values
boolgetBranchId()
Get the branch ID for authorization checks.
public
getBranchId() : int|null
Child classes should override for complex branch relationships.
Return values
int|null —The branch ID, or null if no association
start()
Starts an active window for an entity - save your entity after calling
public
start([Datetime|null $startOn = null ][, Datetime|null $expiresOn = null ][, int|null $termYears = null ]) : bool
Parameters
- $startOn : Datetime|null = null
- $expiresOn : Datetime|null = null
- $termYears : int|null = null
Return values
bool_getExpiresOnToString()
Get the expires on to string virtual field.
protected
_getExpiresOnToString() : mixed
_getStartOnToString()
Get the start on to string virtual field.
protected
_getStartOnToString() : mixed