Loading ginvite.module +4 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Drupal\ginvite\Event\UserRegisteredFromInvitationEvent; use Drupal\ginvite\Plugin\GroupContentEnabler\GroupInvitation; use Drupal\group\Access\GroupAccessResult; use Drupal\group\Entity\GroupContentInterface; use Drupal\group\Entity\GroupInterface; use Drupal\user\UserInterface; /** Loading Loading @@ -56,9 +57,11 @@ function ginvite_form_group_content_form_alter(&$form, FormStateInterface $form_ ], ]; // Is there a group associated with this form instance? $group = $group_content->getGroup(); // Forbid users without the permission to assign roles to users they are // inviting. if (!GroupAccessResult::allowedIfHasGroupPermission($group_content->getGroup(), \Drupal::currentUser(), 'administer members')->isAllowed()) { if ($group instanceof GroupInterface && !GroupAccessResult::allowedIfHasGroupPermission($group, \Drupal::currentUser(), 'administer members')->isAllowed()) { $form['group_roles']['#access'] = FALSE; } } Loading Loading
ginvite.module +4 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Drupal\ginvite\Event\UserRegisteredFromInvitationEvent; use Drupal\ginvite\Plugin\GroupContentEnabler\GroupInvitation; use Drupal\group\Access\GroupAccessResult; use Drupal\group\Entity\GroupContentInterface; use Drupal\group\Entity\GroupInterface; use Drupal\user\UserInterface; /** Loading Loading @@ -56,9 +57,11 @@ function ginvite_form_group_content_form_alter(&$form, FormStateInterface $form_ ], ]; // Is there a group associated with this form instance? $group = $group_content->getGroup(); // Forbid users without the permission to assign roles to users they are // inviting. if (!GroupAccessResult::allowedIfHasGroupPermission($group_content->getGroup(), \Drupal::currentUser(), 'administer members')->isAllowed()) { if ($group instanceof GroupInterface && !GroupAccessResult::allowedIfHasGroupPermission($group, \Drupal::currentUser(), 'administer members')->isAllowed()) { $form['group_roles']['#access'] = FALSE; } } Loading