Adding permissions specific to your module has been moved from the Drupal 7 hook_permissions to a {module}.permissions.yml file. That file contains an element for each permission, along with the human-readable name and description. If we wanted to add a new permission for our module, we would create a mastering_drupal_8.permissions.yml file like:
access test content:
title: Access test content
restrict access: TRUE
description: Whether a user can access test content
You can also add an array for permission_callback array that contains a list of callables that return an array in the same format as the YAML file. For instance, in node.permissions.yml, there is:
permission_callbacks:
- \Drupal\node\NodePermissions::nodeTypePermissions
The function nodeTypePermissions on the NodePermissions class returns an array of permissions with the human-readable title keyed by...