Group member cannot double-click to create a new event

Created on 24 February 2025, about 1 month 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

Production build 0.71.5 2024