Bristol SU Support Package
Public Member Functions | Private Attributes | List of all members
BristolSU\Support\Permissions\Models\Permission Class Reference
Inheritance diagram for BristolSU\Support\Permissions\Models\Permission:
Inheritance graph
[legend]
Collaboration diagram for BristolSU\Support\Permissions\Models\Permission:
Collaboration graph
[legend]

Public Member Functions

 __construct (string $ability='', string $name='', string $description='', string $type='global', ?string $alias=null, ?string $moduleType=null)
 
 getAbility ()
 
 setAbility (string $ability)
 
 getName ()
 
 setName (string $name)
 
 getDescription ()
 
 setDescription (string $description)
 
 getType ()
 
 setType (string $type)
 
 getModuleAlias ()
 
 setModuleAlias (?string $moduleAlias)
 
 getModuleType ()
 
 setModuleType (?string $moduleType)
 
 toArray ()
 
 toJson ($options=0)
 
 __toString ()
 
- Public Member Functions inherited from BristolSU\Support\Permissions\Contracts\Models\Permission
 __construct (string $ability='', string $name='', string $description='')
 

Private Attributes

 $ability
 
 $name
 
 $description
 
 $type
 
 $moduleAlias
 
 $moduleType
 

Detailed Description

Represents a permission

Definition at line 12 of file Permission.php.

Constructor & Destructor Documentation

◆ __construct()

BristolSU\Support\Permissions\Models\Permission::__construct ( string  $ability = '',
string  $name = '',
string  $description = '',
string  $type = 'global',
?string  $alias = null,
?string  $moduleType = null 
)

Populate the permission model with the given attributes

Parameters
string$abilityThe ability string of the permission.
string$nameThe name of the permission
string$descriptionThe description for the permission
string$typeThe type of the permission.
string | null$aliasThe module alias for the permission, if a module permission. Null otherwise
string | null$moduleTypeThe type of module permission if a module permission. Null otherwise

Definition at line 71 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$ability, BristolSU\Support\Permissions\Models\Permission\$description, BristolSU\Support\Permissions\Models\Permission\$moduleType, BristolSU\Support\Permissions\Models\Permission\$name, BristolSU\Support\Permissions\Models\Permission\$type, BristolSU\Support\Permissions\Models\Permission\setAbility(), BristolSU\Support\Permissions\Models\Permission\setDescription(), BristolSU\Support\Permissions\Models\Permission\setModuleAlias(), BristolSU\Support\Permissions\Models\Permission\setModuleType(), BristolSU\Support\Permissions\Models\Permission\setName(), and BristolSU\Support\Permissions\Models\Permission\setType().

Member Function Documentation

◆ __toString()

BristolSU\Support\Permissions\Models\Permission::__toString ( )

Get the permission in a JSON representation

Returns
false|string

Definition at line 240 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\toJson().

◆ getAbility()

BristolSU\Support\Permissions\Models\Permission::getAbility ( )

Get the ability string of the permission

Returns
string

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 86 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$ability.

Referenced by BristolSU\Support\Permissions\Models\Permission\toArray().

◆ getDescription()

BristolSU\Support\Permissions\Models\Permission::getDescription ( )

◆ getModuleAlias()

BristolSU\Support\Permissions\Models\Permission::getModuleAlias ( )

Get the module alias of the module the permission belongs to

Returns
string|null Module alias, or null of a global permission

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 170 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$moduleAlias.

Referenced by BristolSU\Support\Permissions\Models\Permission\toArray().

◆ getModuleType()

BristolSU\Support\Permissions\Models\Permission::getModuleType ( )

Get the type of module permission, either administrator or participant

Returns
string|null administrator or participant, or null if a global permission

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 191 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$moduleType.

Referenced by BristolSU\Support\Permissions\Models\Permission\toArray().

◆ getName()

BristolSU\Support\Permissions\Models\Permission::getName ( )

Get the name of the permission

Returns
string Name

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 107 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$name.

Referenced by BristolSU\Support\Permissions\Models\Permission\toArray().

◆ getType()

BristolSU\Support\Permissions\Models\Permission::getType ( )

Get the type of the permission

Returns
string module or global

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 149 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$type.

Referenced by BristolSU\Support\Permissions\Models\Permission\toArray().

◆ setAbility()

BristolSU\Support\Permissions\Models\Permission::setAbility ( string  $ability)

Set the ability string of the permission

Parameters
string$abilityNew ability string
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 97 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$ability.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ setDescription()

BristolSU\Support\Permissions\Models\Permission::setDescription ( string  $description)

Set the description of the permission

Parameters
string$descriptionNew description
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 139 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$description.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ setModuleAlias()

BristolSU\Support\Permissions\Models\Permission::setModuleAlias ( ?string  $moduleAlias)

Set the module alias the permission belongs to

Parameters
string | null$moduleAliasNew module alias
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 181 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$moduleAlias.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ setModuleType()

BristolSU\Support\Permissions\Models\Permission::setModuleType ( ?string  $moduleType)

Set the type of module permission, administrator or participant

Parameters
null | string$moduleTypeAdministrator or participant
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 202 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$moduleType.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ setName()

BristolSU\Support\Permissions\Models\Permission::setName ( string  $name)

Set the name of the permission

Parameters
string$nameNew name
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 118 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$name.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ setType()

BristolSU\Support\Permissions\Models\Permission::setType ( string  $type)

Set the type of the permission.

Parameters
string$typeOne of global or module
Returns
void

Implements BristolSU\Support\Permissions\Contracts\Models\Permission.

Definition at line 160 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\$type.

Referenced by BristolSU\Support\Permissions\Models\Permission\__construct().

◆ toArray()

BristolSU\Support\Permissions\Models\Permission::toArray ( )

◆ toJson()

BristolSU\Support\Permissions\Models\Permission::toJson (   $options = 0)

Get the permission in a JSON representation

Parameters
int$optionsSee json_encode options for more information
Returns
false|string

Definition at line 230 of file Permission.php.

References BristolSU\Support\Permissions\Models\Permission\toArray().

Referenced by BristolSU\Support\Permissions\Models\Permission\__toString().

Member Data Documentation

◆ $ability

BristolSU\Support\Permissions\Models\Permission::$ability
private

◆ $description

BristolSU\Support\Permissions\Models\Permission::$description
private

◆ $moduleAlias

BristolSU\Support\Permissions\Models\Permission::$moduleAlias
private

◆ $moduleType

BristolSU\Support\Permissions\Models\Permission::$moduleType
private

◆ $name

BristolSU\Support\Permissions\Models\Permission::$name
private

◆ $type

BristolSU\Support\Permissions\Models\Permission::$type
private

The documentation for this class was generated from the following file: