Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\user;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Defines an interface to list available permissions.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface PermissionHandlerInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Gets all available permissions.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @return array
|
Chris@0
|
14 * An array whose keys are permission names and whose corresponding values
|
Chris@0
|
15 * are arrays containing the following key-value pairs:
|
Chris@0
|
16 * - title: The human-readable name of the permission, to be shown on the
|
Chris@0
|
17 * permission administration page. This should be wrapped in the t()
|
Chris@0
|
18 * function so it can be translated.
|
Chris@0
|
19 * - description: (optional) A description of what the permission does. This
|
Chris@0
|
20 * should be wrapped in the t() function so it can be translated.
|
Chris@0
|
21 * - restrict access: (optional) A boolean which can be set to TRUE to
|
Chris@0
|
22 * indicate that site administrators should restrict access to this
|
Chris@0
|
23 * permission to trusted users. This should be used for permissions that
|
Chris@0
|
24 * have inherent security risks across a variety of potential use cases
|
Chris@0
|
25 * (for example, the "administer filters" and "bypass node access"
|
Chris@0
|
26 * permissions provided by Drupal core). When set to TRUE, a standard
|
Chris@0
|
27 * warning message defined in user_admin_permissions() will be displayed
|
Chris@0
|
28 * with the permission on the permission administration page. Defaults
|
Chris@0
|
29 * to FALSE.
|
Chris@0
|
30 * - warning: (optional) A translated warning message to display for this
|
Chris@0
|
31 * permission on the permission administration page. This warning
|
Chris@0
|
32 * overrides the automatic warning generated by 'restrict access' being
|
Chris@0
|
33 * set to TRUE. This should rarely be used, since it is important for all
|
Chris@0
|
34 * permissions to have a clear, consistent security warning that is the
|
Chris@0
|
35 * same across the site. Use the 'description' key instead to provide any
|
Chris@0
|
36 * information that is specific to the permission you are defining.
|
Chris@0
|
37 * - provider: (optional) The provider name of the permission.
|
Chris@0
|
38 */
|
Chris@0
|
39 public function getPermissions();
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Determines whether a module provides some permissions.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @param string $module_name
|
Chris@0
|
45 * The module name.
|
Chris@0
|
46 *
|
Chris@0
|
47 * @return bool
|
Chris@0
|
48 * Returns TRUE if the module provides some permissions, otherwise FALSE.
|
Chris@0
|
49 */
|
Chris@0
|
50 public function moduleProvidesPermissions($module_name);
|
Chris@0
|
51
|
Chris@0
|
52 }
|