Class humhub\libs\BasePermission

Inheritancehumhub\libs\BasePermission » yii\base\BaseObject
Subclasseshumhub\modules\admin\components\BaseAdminPermission, humhub\modules\admin\permissions\ManageGroups, humhub\modules\admin\permissions\ManageModules, humhub\modules\admin\permissions\ManageSettings, humhub\modules\admin\permissions\ManageSpaces, humhub\modules\admin\permissions\ManageUsers, humhub\modules\admin\permissions\SeeAdminInformation, humhub\modules\comment\permissions\CreateComment, humhub\modules\content\permissions\CreatePrivateContent, humhub\modules\content\permissions\CreatePublicContent, humhub\modules\content\permissions\ManageContent, humhub\modules\directory\permissions\AccessDirectory, humhub\modules\post\permissions\CreatePost, humhub\modules\space\permissions\CreatePrivateSpace, humhub\modules\space\permissions\CreatePublicSpace, humhub\modules\space\permissions\InviteUsers, humhub\modules\topic\permissions\AddTopic, humhub\modules\topic\permissions\ManageTopics, humhub\modules\user\permissions\ViewAboutPage

BasePermission

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$defaultAllowedGroups array Default allowed groups humhub\libs\BasePermission
$defaultState string humhub\libs\BasePermission
$description string Description of the permission humhub\libs\BasePermission
$fixedGroups array Default fixed groups humhub\libs\BasePermission
$id string Id of the permission (default is classname) humhub\libs\BasePermission
$moduleId string Module id which belongs to the permission humhub\libs\BasePermission
$title string Title of the permission humhub\libs\BasePermission

Public Methods

Hide inherited methods

MethodDescriptionDefined By
canChangeState() Checks if permission state can be changed humhub\libs\BasePermission
getDefaultState() Returns the default state of the permission. humhub\libs\BasePermission
getDescription() Returns the description humhub\libs\BasePermission
getId() Returns the ID humhub\libs\BasePermission
getLabelForState() Returns the label for given State humhub\libs\BasePermission
getModuleId() Returns the module id humhub\libs\BasePermission
getTitle() Returns the title humhub\libs\BasePermission
hasId() Checks the given id belongs to this permission humhub\libs\BasePermission

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getConfiguredState() Returns the default state set in the configration params 'defaultPermissions'. humhub\libs\BasePermission

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
STATE_ALLOW 1 humhub\libs\BasePermission
STATE_DEFAULT '' Permission States humhub\libs\BasePermission
STATE_DENY 0 humhub\libs\BasePermission

Property Details

$contentContainer public property (available since version 1.2)
$defaultAllowedGroups protected property

Default allowed groups

protected array $defaultAllowedGroups = [\humhub\modules\space\models\Space::USERGROUP_OWNER, \humhub\modules\space\models\Space::USERGROUP_ADMIN]
$defaultState protected property
protected string $defaultState self::STATE_DENY
$description protected property

Description of the permission

protected string $description ''
$fixedGroups protected property

Default fixed groups

protected array $fixedGroups = [\humhub\modules\space\models\Space::USERGROUP_GUEST, \humhub\modules\space\models\Space::USERGROUP_OWNER, \humhub\modules\space\models\Space::USERGROUP_ADMIN]
$id protected property

Id of the permission (default is classname)

protected string $id null
$moduleId protected property

Module id which belongs to the permission

protected string $moduleId ''
$title protected property

Title of the permission

protected string $title ''

Method Details

canChangeState() public method

Checks if permission state can be changed

public boolean canChangeState ( $groupId )
$groupId
getConfiguredState() protected method (available since version 1.2)

Returns the default state set in the configration params 'defaultPermissions'.

This method returns null in case the default state for this permission or group is not set in the configuration.

protected integer getConfiguredState ( $groupId )
$groupId integer
getDefaultState() public method

Returns the default state of the permission.

The defaultState is either defined by setting $defaultState attribute or by overwriting the $defaultState by means of the configuration param 'defaultPermissions'.

If the $defaultState is set to denied, we can grant the permission for specific groups by defining the $defaultAllowedGroups array.

public integer getDefaultState ( $groupId )
$groupId
return integer

The default state

getDescription() public method

Returns the description

public string getDescription ( )
return string

The description of the permission

getId() public method

Returns the ID

public string getId ( )
return string

The id of the permission

getLabelForState() public static method

Returns the label for given State

public static string getLabelForState ( $state )
$state
return string

The label

getModuleId() public method

Returns the module id

public string getModuleId ( )
return string

The moduleid of the permission

getTitle() public method

Returns the title

public string getTitle ( )
return string

The title of the permission

hasId() public method

Checks the given id belongs to this permission

public boolean hasId ( $id )
$id