Group member cannot double-click to create a new event

Created on 24 February 2025, 6 months ago

Problem/Motivation

I'm using fullcalendar and group modules. If I create a group role 'event editor' and assign reasonable permissions, group members with that role cannot double-click on a calendar day to create a new event. (Those members may add/edit/delete events, just not via double-click.)

Looking at line 319 of src/Plugin/views/style/FullCalendar.php, it seems that the module is checking for node.add permission for the node_type 'article' only.

$settings['entityType'] = $this->view->getBaseEntityType()->id();
if (!empty($settings['bundle_type'])) {
  // Can the user add a new event?
  if ($settings['entityType'] === 'node') {
    if ($this->accessManager->checkNamedRoute('node.add', ['node_type' => 'article'])) {
      $settings['addLink'] = 'node/add/' . $settings['bundle_type'];
    }
  }
  else {
    $entity_type = $this->view->getBaseEntityType();
    $entity_links = $entity_type->get('links');
    if (isset($entity_links['add-form'])) {
      $settings['addLink'] = str_replace('{' . $entity_type->id() . '}', $settings['bundle_type'], $entity_links['add-form']);
    }
    elseif (isset($entity_links['add-page'])) {
      $settings['addLink'] = str_replace('{' . $entity_type->id() . '}', $settings['bundle_type'], $entity_links['add-page']);
    }
  }
}

I can confirm that a group member may double-click to add an event if I add the global role permission of 'Bypass content access control' or 'Article: Create new content'.

Proposed resolution

Perhaps change the line to:

if ($this->accessManager->checkNamedRoute('node.add', ['node_type' => $settings['bundle_type']])) {

I'm still wrapping my head around group permissions vs. global permission and group nodes. So I'm not sure that that change will be consistent with how other permissions interact with groups. But this does seem to solve my problem if a add that permission to the global role.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mkindred

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mkindred
  • πŸ‡ΊπŸ‡ΈUnited States mkindred
  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    I created the patch I referenced in the issue description, but the modal 'Create Event' creates the node only, not the group node. So I won't offer it up here until I can determine whether I can make the modal work within group nodes.

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

    Sharing your specific patch might help abstract things out as a starting point.

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

    I've decided not to use groups on my site because of the complexity it adds. However, the issue here (checking for node.add permission for 'article') still exists in fullcalendar. Because the issue title and the entire description here deals with the group module, I'll close this and open a new issue.

Production build 0.71.5 2024