Because Core Profile is deprecated for Drupal 7, it becomes necessary to add support for Profile2 module.
If someone already has a patch ?

CommentFileSizeAuthor
#16 fields.jpg376.23 KBmozh92
#14 fields.jpg65 bytesmozh92
#14 profile types.jpg146.56 KBmozh92
#14 mapping.jpg405.46 KBmozh92

Comments

cezaryrk’s picture

subscribe

mnlund’s picture

Subscribe

slerby’s picture

johnbarclay’s picture

Title: Support of Profile2 » LDAP User: Support of Profile2
Category: support » feature
Priority: Major » Normal

This fits well into ldap_feeds and ldap_user. I'm not tagging this as a 2.0 release blocker, but am willing to get anyone going in the right direction that wants to get this in ldap_user module. It already supports user fields and properties mapping.

johnbarclay’s picture

Status: Active » Postponed
scottAtRoot802’s picture

John, have there been any developers willing to tackle Profile2 support in the ldap_user module. I'm struggling to find a way to map Profile2 fields.

johnbarclay’s picture

No one has offered to take this on. I would suspect its not terribly hard and would simply involve learning the profile2 apis and adding some more options to the ldap_user mapping interface.

jrotondo’s picture

Issue summary: View changes

I would imagine that something along the lines of this needs to be done:
http://gix.my/blog/create-profile2-object-new-user-programatically

oturpin’s picture

Hello,
I have the need to update an LDAP while creating or updating user profiles (based on profile2).
I started a small code derivation that I can propose.

Update takes place in file ldap_servers-tokens.inc in the switch block of function ldap_servers_token_tokenize_user_account :

case 'profile2':
  $parts = explode(':', $attr_name);
  $profile_type_name = $parts[0];
  $profile_field_name = $parts[1];
  $profile_field_value = (isset($parts[2])) ? $parts[2] : 'value';

  $user_profile = profile2_load_by_user($user_account, $profile_type_name);
  if ($user_profile)
  {
      $value = @is_scalar($user_profile->{$profile_field_name}['und'][0][$profile_field_value]) ? $user_profile->{$profile_field_name}['und'][0][$profile_field_value] : '';
  }
break;

This case allows ldap_user to define mappings based on custom tokens as: profile2.profile type:field name:field value name

Example provided below:
[profile2.main:field_adresse:postal_code] => [postalCode]

Please, let me know if this is of any use...
Thx

gangaloo’s picture

subscribe

lpalgarvio’s picture

this would be invaluable for ldap syncing and profile segmentation

lpalgarvio’s picture

grahl’s picture

Title: LDAP User: Support of Profile2 » LDAP User: Support Profile
Version: 7.x-2.x-dev » 8.x-3.x-dev
Priority: Normal » Minor

Since no one stepped up this will likely never get into 7. Leaving this open if someone wants to work on Profile support for 8.

mozh92’s picture

StatusFileSize
new405.46 KB
new146.56 KB
new65 bytes

Hello all
I try create module
You can see my code here: https://github.com/alfaq/ldap_profile
I implements hook_user_update for create/update profiles and implement hook_ldap_user_attrs_list_alter for add options on admin/config/people/ldap/user config page
On my screenshots you can see work process
It work only from AD to Drupal

mozh92’s picture

mozh92’s picture

StatusFileSize
new376.23 KB
grahl’s picture

Status: Postponed » Active

Hi mozh92

Great job! How about you add your repository to drupal.org as a separate project? I'll provide a link to it from the project page if you do so.

Minor things I noticed:
- Coding standards / phpdoc not 100% there yet, try pareview.sh
- composer.json could provide the dependency on profile automatically (also a reason why I'd like to avoid including it in this project)
- I'd change the field prefix in the dropdown from "Field: Profile $name" to "Profile $x field: $name"

grahl’s picture

Status: Active » Postponed

@mozh92 Any chance you could publish that module on drupal.org?

harlor’s picture

I think I might use a similar approach to @mozh92

See: https://github.com/harlor/ldap_profile

Generally, this module is still work in progress. Currently, there will probably be problems when having more than one profile type. I tested with the 8.x-4.x branch of the LDAP module.

@grahl, in https://github.com/harlor/ldap_profile/blob/8.x-1.x/src/EventSubscriber/... I actually wanted to use DrupalUserProcessor::parseUserAttributeNames() which is not accessible outside its original class is it?

grahl’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev
anybody’s picture

Still an active issue. Would be very helpful for popular projects like https://www.drupal.org/project/social

anybody’s picture

Status: Postponed » Active

Just spent some hours on this and created a fork at https://github.com/JPustkuchen/ldap_profile with 8.x-4.x-dev for https://www.drupal.org/project/social which uses profiles.

Profile fields are successfully added to be selectable in the Drupal Mappings form (admin/config/people/ldap/user_drupal). They are also saved, but I couldn't find out why they are no more shown below AFTER saving the mappings.

@grahl: Could you perhaps have a quick look at the code why this might happen?

I'll test if the LdapProfileSyncSubscriber works and retrieves the values from LDAP later, anyway I guess it shouldn't be used before the bug mentioned above could be solved.

If it works generally and we're sure the concept is OK, I'll have a closer look at the points mentioned in #17 like for example adding composer.json and pareview.

@Harlor: Would you like to create a Drupal.org module from that? I don't want to steal your core, but of course I can create the module and add you and @grahl as maintainer for example, if you have no time for that.

Settings this to active again as it would be very useful for 4.x stable release.

anybody’s picture

Ok I just found out that the forked ldap_profile module works fine with 4.x. The reason for the disappearing fields is NOT within the submodule, but ldap module itself. As long as no LDAP Query is configured or server connected, the fields are not shown.

So the ldap_profile module is ok and working with some bugfixes in my fork, but could still need some more love. Now we should decide how to proceed.

@maintainer:

1. Like written in #22 already: Would you like to add this to ldap or as submodule or should a separate module be created for that? I wrote @harlor an issue in the Github project to ask him: https://github.com/harlor/ldap_profile/issues/1

2. This is off-topic, but I'd like to hear if the behaviour (missing fields in table after save until LDAP & Query works) is expected behaviour, as I found it quite confusing that the fields are not showing after save without any message / notice about it. Is there a separate issue for that already that you know?

grahl’s picture

1. Like written in #22 already: Would you like to add this to ldap or as submodule or should a separate module be created for that?

Separate module please, the slimmer we can keep the core module the better.

2. This is off-topic, but I'd like to hear if the behaviour (missing fields in table after save until LDAP & Query works) is expected behaviour, as I found it quite confusing that the fields are not showing after save without any message / notice about it. Is there a separate issue for that already that you know?

I don't think we have an issue that really addresses that, please open one with more details, I have to admit that from the short description I'm not sure if this is just the mapping or also a value check or if we are not checking preconditions successfully.

anybody’s picture

Thank you @grahl!

I just contacted @harlor here https://github.com/harlor/ldap_profile/issues/1 and think he will create a separate module based on our code soon. We're already using the implementation from https://github.com/JPustkuchen/ldap_profile successfully. After the module has been created it would be nice to link it on the ldap module page.

harlor’s picture

Thank you Anybody! I just created the Drupal module: https://www.drupal.org/project/ldap_profile

grahl’s picture

Status: Active » Closed (outdated)

Thanks for the feedback harlor, closing ticket accordingly.