Custom Permissions with Node Access Grants in Drupal 8

Prerequisite for attendees

  • Basic Knowledge of Drupal

Session Details

    In Drupal, there are a number of ways in which you can set permissions for anonymous, authenticated, and admin users through the GUI. Quite a times, however, we need to define advance or custom permission for different users.

    Managing permissions with hook_node_access() work fine in many cases, but it’s not the most flexible way to manage access to your nodes.

    The node access grant system is a way that helps you to control various operations programmatically, like view, create, edit and delete. Also, these operations provide very granularly access to all four operations on your Drupal nodes.

    The system allows you to define certain realms of functionality (related to your access requirements) and a set of grants that are required for any of the four mentioned operations. After that users need to possess the grants in the respective realms in order to be granted access

    ​​​​​​This session we will cover

    • Introduction to Drupal 8 access system
    • Drupal node_acces table overview
    • Grants and realm in Drupal 8
    • Drupal hooks to change permission
    • Demo

    Expected Audience: All Drupal developers.

    Key Takeaway

    • A moderate-level understanding of Drupal Node Access system
    • Will be able to create a custom module to set own permissions.