Backup of db before drupal security update
[yaffs-website] / web / core / modules / user / src / RoleInterface.php
1 <?php
2
3 namespace Drupal\user;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6 use Drupal\Core\Session\AccountInterface;
7
8 /**
9  * Provides an interface defining a user role entity.
10  *
11  * @ingroup user_api
12  */
13 interface RoleInterface extends ConfigEntityInterface {
14
15   /**
16    * Role ID for anonymous users; should match what's in the "role" table.
17    */
18   const ANONYMOUS_ID = AccountInterface::ANONYMOUS_ROLE;
19
20   /**
21    * Role ID for authenticated users; should match what's in the "role" table.
22    */
23   const AUTHENTICATED_ID = AccountInterface::AUTHENTICATED_ROLE;
24
25   /**
26    * Returns a list of permissions assigned to the role.
27    *
28    * @return array
29    *   The permissions assigned to the role.
30    */
31   public function getPermissions();
32
33   /**
34    * Checks if the role has a permission.
35    *
36    * @param string $permission
37    *   The permission to check for.
38    *
39    * @return bool
40    *   TRUE if the role has the permission, FALSE if not.
41    */
42   public function hasPermission($permission);
43
44   /**
45    * Grant permissions to the role.
46    *
47    * @param string $permission
48    *   The permission to grant.
49    *
50    * @return $this
51    */
52   public function grantPermission($permission);
53
54   /**
55    * Revokes a permissions from the user role.
56    *
57    * @param string $permission
58    *   The permission to revoke.
59    *
60    * @return $this
61    */
62   public function revokePermission($permission);
63
64   /**
65    * Indicates that a role has all available permissions.
66    *
67    * @return bool
68    *   TRUE if the role has all permissions.
69    */
70   public function isAdmin();
71
72   /**
73    * Sets the role to be an admin role.
74    *
75    * @param bool $is_admin
76    *   TRUE if the role should be an admin role.
77    *
78    * @return $this
79    */
80   public function setIsAdmin($is_admin);
81
82   /**
83    * Returns the weight.
84    *
85    * @return int
86    *   The weight of this role.
87    */
88   public function getWeight();
89
90   /**
91    * Sets the weight to the given value.
92    *
93    * @param int $weight
94    *   The desired weight.
95    *
96    * @return $this
97    */
98   public function setWeight($weight);
99
100 }