I just finished the Hello World module tutorial for Drupal 8. The tutorial takes you through the process of creating an administration page to configure the module so that you can change via settings to whom the page says hello.

By default, the config page only requires the 'access content' user permission to view. I realize I can change the value to require any other already defined permission if I want, but how can I define a new permission specifically to administer just this module and nothing else? I found this similar question by searching, but it's for Drupal 7 instead of 8, and the solution leaves a lot to be desired; I would like my module to be self-contained, and requiring that the user download a non-core third-party module is not something I am prepared to do.


1 Answer 1


Permissions can be added in the mymodule.permissions.yml file of the custom module.

You can also define permissions with a callback, if they depend on other items in the application.

See: https://kevinquillen.com/drupal/2016/02/21/dynamic-permissions-in-drupal-8

  • The link leads to time out error message (522)
    – pmagunia
    Commented Dec 12, 2020 at 19:04
  • Sorry, AWS instance was not responding for some reason. I rebooted the instance.
    – Kevin
    Commented Dec 12, 2020 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.