Issue when creating/editing nodes using Group 3.x "This entity (node: xxx) cannot be referenced. You are not allowed to remove this item."

Created on 15 February 2023, almost 2 years ago
Updated 9 December 2023, about 1 year ago

Problem/Motivation

I'm using Group 3.x. When I'm using an Editor group role I've created, that maps an Editor global role, I get issues when adding/editing a node.

Adding a node and associating with a group as administrator:

Adding a node and associating with a group as editor:

Editing a node that is asssociated to a group as administrator:

Editing a node that is already assocated to a group I belong as editor:

There's nothing I tweak in permissions (both global and group permissions) that gets rid of that limitation.

The "You are not allowed to remove this item." comes form EntityGroupFieldWidgetBase when permissions are checked and $can_delete is set to false. In my group node permissions I have:

What permission do I need to be able to reference that node and also to remove relationship between node and group?

Steps to reproduce

See video: https://www.drupal.org/files/issues/2023-09-22/video1254802478.mp4 β†’

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Widgets

Created by

πŸ‡¨πŸ‡¦Canada gwvoigt London, ON πŸ‡¨πŸ‡¦

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

  • Issue created by @gwvoigt
  • Status changed to Closed: duplicate almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Thanks for reporting the bug. However, it's already being addressed at πŸ“Œ Add compatibility with Group v2 and v3 Fixed so let's focus our efforts there. Thanks!

  • Status changed to Active over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States caesius

    This still seems to be an issue when using Group version 2, despite the previous comment.

  • πŸ‡ΊπŸ‡ΈUnited States caesius
  • πŸ‡ΊπŸ‡ΈUnited States caesius

    The issue seems to be coming from this block of code.

    https://git.drupalcode.org/project/entitygroupfield/-/blob/1db7be45e7df6...

  • πŸ‡ΊπŸ‡ΈUnited States caesius

    I've been trying to replicate the issue from scratch on a vanilla sandbox site without success.

    To clarify, the specific issue I'm seeing is that editors in groups are getting the error "This entity (node: 1234) cannot be referenced" along with the expected "You are not allowed to remove this item" error, but there doesn't seem to be any issue with editing/saving nodes. It seems to only happen on nodes which are Unpublished.

    I suppose this issue could be set to Closed or Postponed if I don't come up with steps to reproduce very soon.

  • πŸ‡ΊπŸ‡ΈUnited States jascote

    I don't have a fix, but I want to confirm that the error is still possible on 2.0.0--alpha1 even though the issue DWW mentions above is in that release.

    Replicating the issue
    Does anyone who is experiencing this issue have workflow enabled?

    For me, having workflow enabled and saving in any state other than published seems to be the issue. Once I move the state to published, that error goes away.

    The confusing part is that even while I'm still getting the error on the node, if I go to the group's list of nodes, the new node displays in that list. And, as in the issue's screenshots, the group name is listed just above the error. I see the relationship entity in the db.

    Without Workflow
    I turned off workflow moderation for this content type, created a new node and saved as unpublished and I did NOT get the error.

  • πŸ‡ΊπŸ‡ΈUnited States caesius

    It looks like adding a Workflow to the group content does the trick for reproducing the issue.

  • πŸ‡ΊπŸ‡ΈUnited States caesius

    I was able to replicate the issue on a fresh Drupal install, as demonstrated by the attached video. The error appears at 7:05.

  • πŸ‡ΊπŸ‡ΈUnited States caesius
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Indeed, apologies that I misunderstood the bug at first and thought this was being fixed elsewhere. I wonder how much of it is what I proposed to clean up at #3152723: Hide aspects of the widgets that a user doesn't have permission to use β†’ but never had time for.

    That said, sounds like there's still an error here with workflow enabled, which we don't yet have any tests for.

    @caesius, any chance you could take the steps from your video and turn them into an automated test? πŸ™ Or maybe
    @jascote? That'd be super helpful towards getting this fixed.

    Thanks!
    -Derek

Production build 0.71.5 2024