Reader small image

You're reading from  Drupal 10 Development Cookbook - Third Edition

Product typeBook
Published inFeb 2023
PublisherPackt
ISBN-139781803234960
Edition3rd Edition
Tools
Concepts
Right arrow
Authors (2):
Matt Glaman
Matt Glaman
author image
Matt Glaman

Matt Glaman is an open source developer who has been working with Drupal since 2013. Since then, he has contributed to Drupal core and over 60 community projects. He is also a speaker at multiple Drupal community events, including DrupalCon. Matt is currently a principal software engineer at Acquia and was previously a product lead at Centarro, helping maintain Drupal Commerce.
Read more about Matt Glaman

Kevin Quillen
Kevin Quillen
author image
Kevin Quillen

Kevin Quillen has been working with Drupal since 2006. He's contributed several community modules, and built websites using Drupal for brands such as Dogfish Head Craft Brewery, the National Bureau of Economics, Harvard University, MTV, Yale University, Verizon, the Museum of Science, and countless others. You can find him engaged and helping community members on Slack, Drupal StackExchange, or sharing his thoughts on his personal blog. Kevin is also an Acquia Triple Certified Drupal Expert, an Acquia Certified Site Studio Site Builder, and an Acquia Certified Cloud Platform Pro. He is currently a principal developer and Drupal practice lead at Velir.
Read more about Kevin Quillen

View More author details
Right arrow

Implementing access control for an entity

All entity types have an access handler used to control whether a user has access to create, read, update, or delete an entity. Both configuration and content entity types default to the \Drupal\Core\Entity\EntityAccessControlHandler class as their access handler. This handler, however, only supports checking the admin_permission of the entity type.

The Entity API module is a contributed project used to build enhancements on the Entity system in Drupal core and improve the developer experience with creating and maintaining custom entity types. It provides a permission provider to generate create, read, update, and delete permissions for an entity type. To complement the permission provider, it also has an access handler that supports the generated permissions.

In this recipe, we will use the permission provider and access handlers from the Entity API module for the Message entity type created previously in this chapter.

Getting ready...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Drupal 10 Development Cookbook - Third Edition
Published in: Feb 2023Publisher: PacktISBN-13: 9781803234960

Authors (2)

author image
Matt Glaman

Matt Glaman is an open source developer who has been working with Drupal since 2013. Since then, he has contributed to Drupal core and over 60 community projects. He is also a speaker at multiple Drupal community events, including DrupalCon. Matt is currently a principal software engineer at Acquia and was previously a product lead at Centarro, helping maintain Drupal Commerce.
Read more about Matt Glaman

author image
Kevin Quillen

Kevin Quillen has been working with Drupal since 2006. He's contributed several community modules, and built websites using Drupal for brands such as Dogfish Head Craft Brewery, the National Bureau of Economics, Harvard University, MTV, Yale University, Verizon, the Museum of Science, and countless others. You can find him engaged and helping community members on Slack, Drupal StackExchange, or sharing his thoughts on his personal blog. Kevin is also an Acquia Triple Certified Drupal Expert, an Acquia Certified Site Studio Site Builder, and an Acquia Certified Cloud Platform Pro. He is currently a principal developer and Drupal practice lead at Velir.
Read more about Kevin Quillen