You are here

interface PermissionEventInterface in Organic groups 8

Interface for PermissionEvent classes.

This event allows implementing modules to provide their own OG permissions or alter existing permissions that are provided by other modules.

Hierarchy

  • interface \Drupal\og\Event\PermissionEventInterface extends \Drupal\og\Event\ArrayAccess \Drupal\og\Event\IteratorAggregate

Expanded class hierarchy of PermissionEventInterface

All classes that implement PermissionEventInterface

4 files declare their use of PermissionEventInterface
GroupTypeManagerTest.php in tests/src/Unit/GroupTypeManagerTest.php
OgEventSubscriber.php in src/EventSubscriber/OgEventSubscriber.php
PermissionEventTest.php in tests/src/Kernel/PermissionEventTest.php
PermissionManager.php in src/PermissionManager.php

File

src/Event/PermissionEventInterface.php, line 15

Namespace

Drupal\og\Event
View source
interface PermissionEventInterface extends \ArrayAccess, \IteratorAggregate {

  /**
   * The event name.
   */
  const EVENT_NAME = 'og.permission';

  /**
   * Returns the permission with the given name.
   *
   * @param string $name
   *   The name of the permission to return.
   *
   * @return \Drupal\og\PermissionInterface
   *   The permission.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the permission with the given name does not exist.
   */
  public function getPermission($name);

  /**
   * Returns a group content operation permission by its identifying properties.
   *
   * @param string $entity_type_id
   *   The group content entity type ID to which this permission applies.
   * @param string $bundle_id
   *   The group content bundle ID to which this permission applies.
   * @param string $operation
   *   The entity operation to which this permission applies.
   * @param bool $owner
   *   Set to FALSE if this permission applies to all entities, or to TRUE if it
   *   only applies to the ones owned by the user. Defaults to FALSE.
   *
   * @return \Drupal\og\GroupContentOperationPermission
   *   The permission.
   *
   * @throws \InvalidArgumentException
   *   Thrown if the permission with the given properties does not exist.
   */
  public function getGroupContentOperationPermission($entity_type_id, $bundle_id, $operation, $owner = FALSE);

  /**
   * Returns all the permissions.
   *
   * @return \Drupal\og\PermissionInterface[]
   *   An associative array of permissions, keyed by permission name.
   */
  public function getPermissions();

  /**
   * Sets the permission with the given data.
   *
   * @param \Drupal\og\PermissionInterface $permission
   *   The permission to set.
   *
   * @throws \InvalidArgumentException
   *   Thrown when the permission has no name or title.
   */
  public function setPermission(PermissionInterface $permission);

  /**
   * Sets multiple permissions.
   *
   * @param \Drupal\og\PermissionInterface[] $permissions
   *   The permissions to set, keyed by permission name.
   */
  public function setPermissions(array $permissions);

  /**
   * Deletes the given permission.
   *
   * @param string $name
   *   The name of the permission to delete.
   */
  public function deletePermission($name);

  /**
   * Deletes a group content operation permission by its identifying properties.
   *
   * @param string $entity_type_id
   *   The group content entity type ID to which this permission applies.
   * @param string $bundle_id
   *   The group content bundle ID to which this permission applies.
   * @param string $operation
   *   The entity operation to which this permission applies.
   * @param bool $owner
   *   Set to FALSE if this permission applies to all entities, or to TRUE if it
   *   only applies to the ones owned by the user. Defaults to FALSE.
   */
  public function deleteGroupContentOperationPermission($entity_type_id, $bundle_id, $operation, $owner = FALSE);

  /**
   * Returns whether or not the given permission exists.
   *
   * @param string $name
   *   The name of the permission for which to verify the existance.
   *
   * @return bool
   *   TRUE if the permission exists, FALSE otherwise.
   */
  public function hasPermission($name);

  /**
   * Returns if a group content operation permission matches given properties.
   *
   * @param string $entity_type_id
   *   The group content entity type ID to which this permission applies.
   * @param string $bundle_id
   *   The group content bundle ID to which this permission applies.
   * @param string $operation
   *   The entity operation to which this permission applies.
   * @param bool $owner
   *   Set to FALSE if this permission applies to all entities, or to TRUE if it
   *   only applies to the ones owned by the user. Defaults to FALSE.
   *
   * @return bool
   *   Whether or not the permission exists.
   */
  public function hasGroupContentOperationPermission($entity_type_id, $bundle_id, $operation, $owner = FALSE);

  /**
   * Returns the entity type ID of the group to which the permissions apply.
   *
   * @return string
   *   The entity type ID.
   */
  public function getGroupEntityTypeId();

  /**
   * Returns the bundle ID of the group to which the permissions apply.
   *
   * @return string
   *   The bundle ID.
   */
  public function getGroupBundleId();

  /**
   * Returns the IDs of group content bundles to which the permissions apply.
   *
   * @return array
   *   An array of group content bundle IDs, keyed by group content entity type
   *   ID.
   */
  public function getGroupContentBundleIds();

}

Members

Namesort descending Modifiers Type Description Overrides
PermissionEventInterface::deleteGroupContentOperationPermission public function Deletes a group content operation permission by its identifying properties. 1
PermissionEventInterface::deletePermission public function Deletes the given permission. 1
PermissionEventInterface::EVENT_NAME constant The event name.
PermissionEventInterface::getGroupBundleId public function Returns the bundle ID of the group to which the permissions apply. 1
PermissionEventInterface::getGroupContentBundleIds public function Returns the IDs of group content bundles to which the permissions apply. 1
PermissionEventInterface::getGroupContentOperationPermission public function Returns a group content operation permission by its identifying properties. 1
PermissionEventInterface::getGroupEntityTypeId public function Returns the entity type ID of the group to which the permissions apply. 1
PermissionEventInterface::getPermission public function Returns the permission with the given name. 1
PermissionEventInterface::getPermissions public function Returns all the permissions. 1
PermissionEventInterface::hasGroupContentOperationPermission public function Returns if a group content operation permission matches given properties. 1
PermissionEventInterface::hasPermission public function Returns whether or not the given permission exists. 1
PermissionEventInterface::setPermission public function Sets the permission with the given data. 1
PermissionEventInterface::setPermissions public function Sets multiple permissions. 1