class PermissionModel extends Model

A Model that can be managed by users with specific permissions

Constants

CREATE_PERMISSION

The permission required to create such a model

EDIT_PERMISSION

The permission required to edit such a model

SOFT_DELETE_PERMISSION

The permission required to mark this model as deleted

HARD_DELETE_PERMISSION

The permission required to delete this model from the database

Methods

bool
canBeSeenBy(Player $player, bool $showDeleted = false)

Find out whether a player should know that a model exists

static bool
canBeCreatedBy(Player $player)

Find out whether a player can create a model of this type

bool
canBeEditedBy(Player $player)

Find out whether a player can edit this model

bool
canBeSoftDeletedBy(Player $player)

Find out whether a player can soft delete the model

bool
canBeHardDeletedBy(Player $player)

Find out whether a player can delete this model

Details

at line line 46
bool canBeSeenBy(Player $player, bool $showDeleted = false)

Find out whether a player should know that a model exists

Parameters

Player $player The player in question
bool $showDeleted false to hide deleted models even from admins

Return Value

bool

at line line 73
static bool canBeCreatedBy(Player $player)

Find out whether a player can create a model of this type

If possible, prefer to override PermissionModel::CREATE_PERMISSION

Parameters

Player $player

Return Value

bool

at line line 87
bool canBeEditedBy(Player $player)

Find out whether a player can edit this model

If possible, prefer to override PermissionModel::EDIT_PERMISSION and/or PermissionModel::isEditor()

Parameters

Player $player

Return Value

bool

at line line 101
bool canBeSoftDeletedBy(Player $player)

Find out whether a player can soft delete the model

If possible, prefer to override PermissionModel::SOFTDELETEPERMISSION and/or PermissionModel::isEditor()

Parameters

Player $player

Return Value

bool

at line line 114
bool canBeHardDeletedBy(Player $player)

Find out whether a player can delete this model

If possible, prefer to override PermissionModel::HARDDELETEPERMISSION

Parameters

Player $player

Return Value

bool