You are here

public function Channel::removeAuthorizedUser in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_server/src/Entity/Channel.php \Drupal\entity_share_server\Entity\Channel::removeAuthorizedUser()
  2. 8 modules/entity_share_server/src/Entity/Channel.php \Drupal\entity_share_server\Entity\Channel::removeAuthorizedUser()

Remove an authorized user if present. Do not save the entity.

Parameters

string $uuid: The uuid of the user to remove.

Return value

bool TRUE if the authorized_users property has been changed. FALSE otherwise.

Overrides ChannelInterface::removeAuthorizedUser

File

modules/entity_share_server/src/Entity/Channel.php, line 153

Class

Channel
Defines the Channel entity.

Namespace

Drupal\entity_share_server\Entity

Code

public function removeAuthorizedUser($uuid) {
  $authorized_users = $this->authorized_users;
  if (($key = array_search($uuid, $authorized_users)) !== FALSE) {
    unset($authorized_users[$key]);
    $this
      ->set('authorized_users', $authorized_users);
    return TRUE;
  }
  return FALSE;
}