Contains \Drupal\user\UserInterface.
<?php
/**
* @file
* Contains \Drupal\user\UserInterface.
*/
namespace Drupal\user;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Provides an interface defining a user entity.
*/
interface UserInterface extends EntityInterface, AccountInterface {
/**
* Returns a list of roles.
*
* @return array
* List of role IDs.
*/
public function getRoles();
/**
* Whether a user has a certain role.
*
* @param string $rid
* The role ID to check.
*
* @return bool
* Returns TRUE if the user has the role, otherwise FALSE.
*/
public function hasRole($rid);
/**
* Add a role to a user.
*
* @param string $rid
* The role ID to add.
*/
public function addRole($rid);
/**
* Remove a role from a user.
*
* @param string $rid
* The role ID to remove.
*/
public function removeRole($rid);
}
Name | Description |
---|---|
UserInterface | Provides an interface defining a user entity. |