Hello,

thank you for this awesome module, I found little bug when my site used Realname module. Your widget parse usernames from string when saving form input. It's not good practise, I look into entity reference field, which is using uids EntityAutocomplete::validateEntityAutocomplete

I made quickfix which resolves my issue, I'm happy to create patch but maybe it has other consequences

/**
   * Gets the user ids which have been submitted by form.
   *
   * Users which will gain granted access to taxonomy terms.
   *
   * @return array
   *   The user ids which have been submitted.
   */
  public function getSubmittedUserIds() {
    /* There's a $this->oFormState->getValues() method, but
     * it is loosing multiple form values. Don't know why.
     * So there're some custom lines on the $_REQUEST array. */
    $sRawUsers = $_REQUEST['access']['user'];

    if (empty($sRawUsers)) {
      return [];
    }

    $aRawUsers = Tags::explode($sRawUsers);

    $aUserIds = [];
    if (!empty($aRawUsers)) {
      foreach ($aRawUsers as $sRawUser) {
        if (preg_match("/.+\s\(([^\)]+)\)/", $sRawUser, $matches)) {
          $aUserIds[] = $matches[1];
        }
      }
    }

    return $aUserIds;
  }
CommentFileSizeAuthor
#3 realname-compatibility-2916531-3.patch1.32 KBparisek
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

parisek created an issue. See original summary.

Peter Majmesku’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please create a regular patch? Please read this page to learn how to create a patch with Git: https://mobilefish.de/index.php/creating-patch-git

parisek’s picture

Assigned: Unassigned » parisek
Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.32 KB

I created patch that is based on core entity reference field

  • Peter Majmesku committed c0dfa3a on 8.x-1.x authored by parisek
    Issue #2916531 by parisek: Permission based on user account autocomplete...
Peter Majmesku’s picture

Status: Needs review » Fixed

Thanks for reporting and the patch! The patch is part of the latest release version 8.x-1.38. See https://www.drupal.org/project/permissions_by_term/releases/8.x-1.38.

Please feel free to re-open this issue, if you have any objections (do not forget to change the issue status).

Peter Majmesku’s picture

Status: Fixed » Closed (fixed)