PermissionHandlerInterface.php 2.2 KB

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