Field mapping was not yet implemented in D8 version (-dev 2016-Apr-07). After some work this is done, pls. review

Comments

manuel.adan created an issue. See original summary.

larowlan’s picture

Looking good - thanks!

  1. +++ b/ldap_user/LdapUserConf.class.php	2016-04-07 14:43:57.413010490 +0200
    @@ -282,7 +282,17 @@
    +              ¶
    

    Some white space here

  2. +++ b/ldap_user/LdapUserConf.class.php	2016-04-07 14:43:57.413010490 +0200
    @@ -1262,11 +1272,11 @@
    +        $field = \Drupal\field\Entity\FieldStorageConfig::loadByName('user', $value_name);
    

    Can we import the FQCN and use the short name here?

  3. +++ b/ldap_user/LdapUserConf.class.php	2016-04-07 14:43:57.413010490 +0200
    @@ -1262,11 +1272,11 @@
    +        $values = $field->getCardinality() ? array($value) : (array) $value;
    

    D8 will do this for us now

  4. +++ b/ldap_user/LdapUserConf.class.php	2016-04-07 14:43:57.413010490 +0200
    @@ -1274,11 +1284,11 @@
    +            $items[$delta][key($columns)] = $value;
    

    We should use $field->getMainPropertyName instead of inspecting the columns ourself. However, again D8 does this for us, so we can use $user->{$field_name} = $values

queenvictoria’s picture

StatusFileSize
new3.67 KB

I've taken a bash at your recommendations @larowlan as this was on my list of things to do too. Please see if I've done it correctly. It does seem to at least store the configuration.

Also (and I've come across this before) is there a Drupal 8 way to have an "add another row" button rather than a suite of empty rows?

queenvictoria’s picture

StatusFileSize
new10.71 KB

Ok so I wasn't close at all with that.

I've majorly reworked LdapUserConf->entryToUserEdit() to use $account objects rather than $edit arrays. This is because it is used both by create and edit functions. And Drupal 8 doesn't seem to have an equivalent to user_save($account, $edit).

So its a massive patch and requires the patch that switches to using the external_auth module to replace the user->data column that was retired in Drupal 8.
https://www.drupal.org/node/2698157

queenvictoria’s picture

StatusFileSize
new26.27 KB

So I neglected to include the changes from @manuel.adan and this patch is now very tangled with the patch from https://www.drupal.org/node/2698157. I will upload a combined version now and then try to undo the entanglement.

queenvictoria’s picture

StatusFileSize
new20.31 KB

Ok I've also moved "LDAP user properties (PUID, DN...) not saved or updated" in to here and closed that issue.

I've unentangled https://www.drupal.org/node/2698157

Here is a patch that should do the job.

  • queenvictoria committed a9bebf7 on 8.x-3.x
    Issue #2701919 by queenvictoria, manuel.adan: Field mapping support in...
queenvictoria’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.