0

I have a site with several custom entities. For one of the entity types, most objects are fully functional, viewable, usable, but on the entity list page do not offer the Edit option. As my admin user, user 1, I can edit them using a custom form, but not from the default entity_form.

My EntityAccessControlHandler.php starts with:

$roles = $account->getRoles();
if (in_array('administrator', $roles)) {
  return AccessResult::allowed();
}

Why does the Edit option get suppressed? I cannot find corrupted data in these nodes.

At this point, I have a workaround, using a custom form, but am trying to understand the depths of drupal at work here :) !

screenshot

1
  • No permission to perform that action?
    – Kevin
    Feb 1, 2019 at 16:19

1 Answer 1

2

The user looking at the page the screenshot was taken on doesn't have the required level of access/permissions to edit those nodes.

There are many different ways that access/permissions can be configured to a single node, so you'll need to do some digging in your installation to find out whether it's simple core permissions, a contributed module, or a custom module that's causing the problem.

6
  • Thank you for your responses, Kevin and Clive; I am user 1, admin of my drupal site when looking at this screenshot. Admin has permission to edit everything. Thus, I am confused!
    – MEI
    Feb 1, 2019 at 20:10
  • 1
    @MEI: Then your best bet is checking, if any installed module is using hook_node_access() (api.drupal.org/api/drupal/core%21modules%21node%21node.api.php/…) to deny access to your nodes based on a custom condition which doesn't depend on user rights. E.g. search your code base for '_node_access('. Feb 3, 2019 at 8:15
  • thanks, @MarioSteinitz for responding. I have an AccessControlHandler for my custom entity giving 'administrator' full access. Also checked for any _hook_node_access as you suggested, none are implemented. I continue to be stumped.
    – MEI
    Feb 4, 2019 at 16:04
  • @MEI the hook part of this function varies for each module that implements the hook. Therefore, search for _node_access( only. Feb 4, 2019 at 22:32
  • PS.: You are also speaking of "custom entity" and own access handlers. hook_node_access() applies to the generic node entities and their bundles only. If you implemented custom entities, there might be something else wrong with your entity configuration. It also changes the context of your original question about "nodes". Please add all required information to your original question to receive better answers (e.g. the entity annotation, excerpts of your access handler, etc.) Feb 4, 2019 at 23:08

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.