class GroupPermission in Organic groups 8
A group level permission.
This is used for permissions that apply to the group as a whole, such as 'subscribe without approval' and 'administer group'.
Hierarchy
- class \Drupal\og\Permission implements PermissionInterface- class \Drupal\og\GroupPermission
 
Expanded class hierarchy of GroupPermission
4 files declare their use of GroupPermission
- GroupPermissionTest.php in tests/src/ Unit/ GroupPermissionTest.php 
- OgEventSubscriber.php in src/EventSubscriber/ OgEventSubscriber.php 
- PermissionEventTest.php in tests/src/ Unit/ PermissionEventTest.php 
- PermissionEventTest.php in tests/src/ Kernel/ PermissionEventTest.php 
File
- src/GroupPermission.php, line 13 
Namespace
Drupal\ogView source
class GroupPermission extends Permission {
  /**
   * A list of roles to which this permission can be applied.
   *
   * For example, the 'subscribe' permission only applies to non-members. If
   * left empty, this permission applies to all roles.
   *
   * @var array
   */
  protected $roles = [];
  /**
   * Returns the roles to which this permission can be applied.
   *
   * For example, the 'subscribe' permission only applies to non-members.
   *
   * @return array
   *   An array of roles to which this permission applies. If empty, the
   *   permission applies to all roles.
   */
  public function getApplicableRoles() {
    return $this
      ->get('roles');
  }
  /**
   * Returns the roles to which this permission can be applied.
   *
   * For example, the 'subscribe' permission only applies to non-members.
   *
   * @param array $roles
   *   An array of roles to which this permission applies. If empty, the
   *   permission applies to all roles.
   *
   * @return $this
   */
  public function setApplicableRoles(array $roles) {
    $this
      ->set('roles', $roles);
    return $this;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| GroupPermission:: | protected | property | A list of roles to which this permission can be applied. | |
| GroupPermission:: | public | function | Returns the roles to which this permission can be applied. | |
| GroupPermission:: | public | function | Returns the roles to which this permission can be applied. | |
| Permission:: | protected | property | The default roles to which this permission applies. | |
| Permission:: | protected | property | A short description of the permission. | |
| Permission:: | protected | property | The name of the permission. | |
| Permission:: | protected | property | If the permission is security sensitive and should be limited to admins. | |
| Permission:: | protected | property | The human readable permission title. | |
| Permission:: | public | function | Returns the value for the given property. Overrides PermissionInterface:: | |
| Permission:: | public | function | Returns the default roles. Overrides PermissionInterface:: | |
| Permission:: | public | function | Returns the description. Overrides PermissionInterface:: | |
| Permission:: | public | function | Returns the machine name of the permission. Overrides PermissionInterface:: | |
| Permission:: | public | function | Returns whether or not access is restricted. Overrides PermissionInterface:: | |
| Permission:: | public | function | Returns the human readable permission title. Overrides PermissionInterface:: | |
| Permission:: | protected static | function | Converts the given string in a lowerCamelCase version. | |
| Permission:: | public | function | Sets the value for the given property. Overrides PermissionInterface:: | |
| Permission:: | public | function | Sets the default roles. Overrides PermissionInterface:: | |
| Permission:: | public | function | Sets the description. Overrides PermissionInterface:: | |
| Permission:: | public | function | Sets the machine name of the permission. Overrides PermissionInterface:: | |
| Permission:: | public | function | Sets the access restriction. Overrides PermissionInterface:: | |
| Permission:: | public | function | Sets the human readable permission title. Overrides PermissionInterface:: | |
| Permission:: | protected | function | Validates the given property and value. | 1 | 
| Permission:: | public | function | Constructs a Permission object. | 
