I am having trouble grabbing the second value from a multivalue variable. My first value is username. When I validate against LDAP, it creates a role that is the same as my username (stephen_r). I want it to grab the second variable, which is the role. Any thoughts? Thanks.

I am using Group by entry.

Comments

miglius’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +ldapgroups

Please paste here your your exact ldapgroups settings, we need your configuration to troubleshoot.

gettysburger’s picture

StatusFileSize
new113.95 KB

Thanks. Here they are.

gettysburger’s picture

I'm back on this issue trying to get LDAP Groups to work. It worked for me before when they were set externally, but have not worked for me since they went into the admin section.

I have been using the dev from March 30, so I tried the May 9th and have gotten an error:

• warning: ldap_get_option(): supplied argument is not a valid ldap link resource in /srv/www/htdocs/sites/all/modules/ldap_integration/includes/LDAPInterface.inc on line 82.
• warning: ldap_errno(): supplied argument is not a valid ldap link resource in /srv/www/htdocs/sites/all/modules/ldap_integration/includes/LDAPInterface.inc on line 167.
• warning: ldap_error(): supplied argument is not a valid ldap link resource in /srv/www/htdocs/sites/all/modules/ldap_integration/includes/LDAPInterface.inc on line 167.

The third line looks like a typo? ldap_errno()

I also tried uninstalling Persistent Login because I read that people were having trouble with that killing their Groups sync. No luck. Thanks.

gettysburger’s picture

BTW, my IT guy tells me we are working with a Novell system. Would that make a difference as to which settings I should be using? Thanks.

gettysburger’s picture

This was my old ldapgroups.php file that worked just fine:

function ldapgroups_role_mappings() {
  return array(
     // LDAP group: Staff => Drupal role: hcc staff
	// 'cn=Staff' => 'hcc staff';
	//'cn=Faculty' => 'hcc faculty'
    // Make sure the last group->role mapping does NOT have a trailing comma (,).
    //'cn=admin,ou=Group,dc=example,dc=com' => 'IT'
	'Staff' => 'Staff',
	'Student Worker' => 'Staff',
	'Faculty' => 'Faculty',
	'Adjunct Faculty' => 'Adjunct Faculty'
	//'Student' => 'Registered Student'
	//'cn=Faculty' => 'hcc faculty'
  );
}

/**
 * Note: Uncommenting this function will limit the groups -> roles conversion to ONLY those groups that are
 * specified in the function ldapgroups_role_mappings().
 */

function ldapgroups_roles_filter($groups) {
  $roles = array();
  // This should take the roles array, pass it thru the filters and send a NEW set of roles back the filter.
  foreach ($groups as $group) {
    foreach (ldapgroups_role_mappings() as $approved_group => $approved_role) {
      // Must strip spaces?
      $group_stripped = preg_replace('/\s+/', '', $group);
      $approved_group_stripped = preg_replace('/\s+/', '', $approved_group);
      if (strcasecmp($approved_group_stripped, $group_stripped) == 0) {
        // This role is specified - grant.
        $roles[] = $approved_role;
      }
    }
  }
  return $roles;
}

I am not able to get this to work with the updated internal interface. Any thoughts? Thanks.

miglius’s picture

ldap_errno() is not a typo, but a valid function http://lt.php.net/manual/en/function.ldap-errno.php

It looks like the connection to the LDAP server is not established. Please look at the watchdog messages, they might give some hint. I haven't tried with the Novell though.

gettysburger’s picture

Thanks for the note.

When a new staff member logs in to the site for the first time it grabs their Title, Department, Room Number, Phone Extension, basically everything but their Group. Can it do that without an LDAP connection?

The reports don't show any problems.

The question I have is: when it was working before, when I had the group info in a separate file, it seemed very simple. Now it seems to be asking for a lot more information. My users, in the network, belong to a group called "Staff". I want to map to a role named "Staff". Do you think this is no longer possible with Novell? Thanks.

gettysburger’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new63.36 KB

I got it to create a Role based on my Username. That is not what I was trying for, but it may be some progress, nonetheless.

miglius’s picture

You configuration is incorrect.

If you use "Group is specified in user's DN", the "Attribute of the DN which contains the group name:" cannot be a CN attribute, since the CN attribute specifies not a group but the user itself. This attribute can be OU or contain other value based on you LDAP setup.

I don't know you setup, but maybe it would be enough just to use the third set of options, "Group by entry". This is used if you have a group entry in the LDAP which lists all the members.

gettysburger’s picture

StatusFileSize
new47.54 KB

I got rid of the first set of options and just used the third. Now no roles are created.

Here is my basic setup. Thanks again for your help.

miglius’s picture

How are the groups stored in the LDAP, i.e., a group has a DN and contains all the members, or the each LDAP user has an attribute specifying the group it belongs to or do you want to extract the group from the user's DN?

gettysburger’s picture

There are two ways to get the groups:

We're pulling from a novell directory and the net admins have the users grouped by dn. There is only two groups stored this way. Students and everyone else.

Also, there is two cn attributes assigned to each user. The second cn attribute on each user is a more detailed group designator. This is where we get roles such as Staff, Faculty,...etc.

miglius’s picture

Could you post an example of the user and group DNs or all LDIF entry (with sensitive information changed to *)? that would give an idea how LDAP entries look like.

gettysburger’s picture

StatusFileSize
new158.76 KB

My admin guy sent me this file in answer to your question. I hope it is what you need. Thanks.

miglius’s picture

Your LDAP structure is a little wired for me. I looked at "Adjunct Faculty" and this is not a group, but a second CN attribute as well as the Title attribute. I cannot see a LDAP entry for a group "Adjunct Faculty".

gettysburger’s picture

Thanks for the note. My IT guy is off today but I will ask him to explain his 'interesting' setup in the morning.

gettysburger’s picture

Yeah, our Novell guys did not set the system up in any comprehensible way. Nonetheless, that is what I have to work with. Sorry.

The second cn attribute is what I had working before and is what I would like to get working now. Thanks.

gettysburger’s picture

Does anyone have any thoughts how I can get this to work? I had it working with the group mappings in an external file. Now that it is in the interface I can not get the setting right. Would anyone that has this working please send me a screen shot of their settings so that i can give it a try.

I have pretty much resolved myself to the fact that this module does not work for mapping groups to roles. I will have to enter the groups/roles manually. I was going to go back to the older version that I had working, but I wish to use the LDAP sync module that I have seen elsewhere. The other parts work and thank you for that.

cgmonroe’s picture

Status: Active » Closed (fixed)

Clearing out old support requests - reopen if problem still exists in newest code