Authentication

How to use multiple LDAP servers with Moodle 1.8

 
Picture of Imran Hussain
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi,

I am having difficulty in applying the patch to the folders using GnuWin32 & cmd.

Is it possible you could send me the patched folder for ldap2 so that I can stick it into the folder path auth/

I would really appreciate it, many thanks.

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi,

which exact Moodle version are you using (please, cite the version numbers from version.php, as each version can have slight changes from one each other smile)

Saludos.
Iñaki.
 
Average of ratings: -
Picture of Imran Hussain
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi,

This is taken from version.php

Moodle Version:

version  = 2012120303.04
release  = '2.4.3+ (Build: 20130405)'

PHP Version: 5.3.10

I did try to patch the files yesturday, first two patches were fine (.patch & .diff) but the php patch did not work. sad 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Imran,

your version of Moodle is a bit newer that the one I used to create the patch for 2.4, and has a couple of bug fixes that weren't present before. That's why the patches might not apply cleanly. I've created a new version of the patch that should apply cleanly if you follow the instructions given at https://moodle.org/mod/forum/discuss.php?d=74279#p752238

Hope that helps.

Saludos.
Iñaki.
Picture of Imran Hussain
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki,

The patch worked a treat. I can now have both staff & student login using the LDAP auth.

Thank you for your time and effort in helping me and others achieve what was required.

Kind Regards.

 
Average of ratings: -
Picture of Cristian Zanni
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hey Iñaki,

it is possible to download some patch to the Moodle 2.1 Version?

Thanks  / Gracias!

Cristian

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

I don't have a patch for 2.1 yet.I'll see if I can make one in a reasonable amount of time.

Saludos. Iñaki.

 
Average of ratings: -
Picture of Cristian Zanni
Re: How to use multiple LDAP servers with Moodle 1.8
 

Nevermind Iñaki, we achieved this by using the folder provided by Flavio Camargo; patch was not needed!

https://moodle.org/pluginfile.php/183/mod_forum/attachment/874648/ldap2.rar

Anyway, i want to appreciate your help here and also make a little contribution: In our scenario, we faced a domain migration. So, some users were migrated from domainA to domainB.

After we applied this workaround (duplicate ldap plugin) we had to UPDATE the "auth" field at mdl_user table of every migrated user by replacing "ldap" to "ldap2" (or the name you used in the second ldap plugin).

This is because the moodle users table were previously populated with the ldap "original" plugin. New users at domainB were able to login smoothly

Cheers!

Saludos!

Cristian

 

 

 

 

 

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Glad that you didn't need it smile

I had a little spare time today and produced the patch anyway (it was very easy starting from the patch for 2.0.x).

So here it goes in case someone else needs it wink

Saludos. Iñaki.

Picture of Anthony Connor
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki,

I am using version 2.4.4+ (Build: 20130621), maturity = MATURITY_STABLE;

PHP version 5.3.10.

Could I use the patch for 2.4.3 ( ldap-clones-patch-scriptv8b_2.4.3.zip) or will it not work. If so any chance you would be able to updating the patch for this version?

It would be brilliant if you could help me out of this jam, many thanks,

Anthony

 
Average of ratings: -
Picture of Anthony Connor
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi again,

So I decided to try the 2.4.3 ( ldap-clones-patch-scriptv8b_2.4.3.zip) patch on the moodle version 2.4.4+ (Build: 20130621) that I am running and it worked.

I first tried the patch in a test environment - a 32bit ubuntu server (php 5.4.3) and it patched correctly and I was able to successfully edit the LDAP connection settings, enable the new LDAP connection type and login to moodle using valid AD accounts over LDAP.

Thanks for the patch Iñaki. smile

Anthony

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Hi there,

in case anyone is interested on it, here's the patch for Moodle 2.5.x (current as of today).

Saludos. Iñaki.

Picture of Kester David
Re: How to use multiple LDAP servers with Moodle 1.8
 

Thanks a Mil! Iñaki

 

Works perfect!

 
Average of ratings: -
Picture of Lee Procter
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki,

The patch you have created is an excellent solution and works a treat.

Will there be a update file to support version 2.5.2+ (Build: 20131101) any time soon. We are looking to upgrade very shortly.

 

Lee

 

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Hi Lee,

this version should apply cleanly to 2.5.2+ current as of today, and 2.5.3+ current as of today.

Saludos. Iñaki.

Picture of Lee Procter
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Inaki,

I have tested the patch on ver 2.5.2 but get the following output on the first patch:

patching file auth/ldap/auth.php
patching file auth/ldap/cli/sync_users.php
patching file auth/ldap/config.html
Hunk #3 FAILED at 187.
1 out of 14 hunks FAILED -- saving rejects to file auth/ldap/config.html.rej
patching file auth/ldap/ntlmsso_attempt.php
patching file auth/ldap/ntlmsso_finish.php
patching file auth/ldap/ntlmsso_magic.php
patching file auth/ldap/version.php

 

Any ideas? Thanks in advance

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Lee,

the patch if for 2.5.2+ (Build 21031101) or later, not for 2.5.2 (Build: 20130909). There's no point in running 2.5.2 when 2.5.2+ is out fixing a few bugs (and not introducing new features). That's why I cooked the patch for 2.5.2+.

Saludos.
Iñaki.
 
Average of ratings: -
Picture of Karl Brooker
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Inaki,

Do you plan an update for version 2.6? I've just built a fresh 2.6 box and wondered if I should wait or just try the 2.5.2+ patch.

Regards,
Karl

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Karl,

here's a version for 2.6+ (Build: 20131129), current as of today.

Saludos.
Iñaki.
Ernesto
Re: How to use multiple LDAP servers with Moodle 1.8
 

hi Iñaki Arenaza

I hope you can help me, I'm working with Moodle 2.6 + on windows with wamp. I installed patch.exe but I get the following error when running the. patch

with the instruction of. php no problem, if the directory is generated LDAP2 moodle me but when I open the problem appears.

The "auth_ldap2" plugin is installed in the wrong location "$ CFG-> dirroot/auth/ldap2", the expected location is "$ CFG-> dirroot / auth / ldap"

How I can install the. Patch on windows?

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Ernesto,

make sure you follow the right instructions to apply the patch on Windows, as I said earlier in this thread: https://moodle.org/mod/forum/discuss.php?d=74279#p752740

Saludos.
Iñaki.
 
Average of ratings: -
Ernesto
Re: How to use multiple LDAP servers with Moodle 1.8
 

Thanks Iñaki

I set up moodle on Ubuntu and I had no problems to clone ldap, I have two domains with organizational units are around 200 each domain. the detail that I have now is that it takes a long time to authenticate a user. as I can do to make it faster reading's site. as I can change the page size to change the value default is 250. the type of encoding that uses my server is utf-8, version 3.

I hope you can help me thanks in advance!

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Ernesto,

I'm afraid I don't understand what your problem is and why you want to change the page size (which doesn't affect the login time at all).

Could you elaborate it a bit?

Saludos.
Iñaki.

P.S. I speak Spanish, in case you feel you can describe your problem more easily in Spanish smile
 
Average of ratings: -
Picture of Alan Hare
Re: How to use multiple LDAP servers with Moodle 1.8
 

Iñaki,

I tried using your patch ldap-clones-patch-scriptv10_2.5.2 on moodle_2.5.3+_build_20131115 from 11th Nov 2013, but does not work.

  • patch.exe --dry-run -p1 < 0001-Add-support-for-multiple-clones-of-the-LDAP-auth-plu.patch
  • Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

Thank you for your assistance! smile

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Alan,

If you are trying to use these patches on Windows (and it looks like you are using Windows, judging from your patch.exe command smile), make sure you follow the instructions given in this page: http://docs.moodle.org/en/Development:How_to_apply_a_patch#Apply_a_Patch_in_Windows_using_gnuwin32

Saludos.
Iñaki.


 
Average of ratings: -
Picture of Alan Hare
Re: How to use multiple LDAP servers with Moodle 1.8
 

You are correct, I was using the wrong command/file.  :/

When I run the correct file ldapname.diff accoring to the Windows directions I get this

Am I missing something?

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Hi Alan,

you were using the right file, but the wrong procedure (for Windows). The problem is the patch file (0001-bla-bla-bla.patch) has Unix line endings. And patch.exe for Windows doesn't like them (that's why you got an assert failure). You need to convert the Unix line endings to Windows line endings before trying to apply the patch.

That's why the instructions on how to apply a patch on Windows tells you to "Open the patch file with Wordpad, and click 'File' >> 'Save as...', choose a different name for the file eg ('mynewpatch.diff') and "Save as type" >> 'Text Document - MS-DOS Format' " (in the link I provieded before).

Saludos. Iñaki

 
Average of ratings: -
Picture of Alan Hare
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki, Thanks for the reply! smile

I changed the file format as directed in the document, but I still receive an error. 

 
Average of ratings: -
Picture of Alan Hare
Re: How to use multiple LDAP servers with Moodle 1.8
 

UPDATE: I went line by line for the config.html section of the patch file and changed it.. they all matched.  Then I was able to run the command "php -f ldapname.php ldap2" to make the duplicate copy of the plugin.

Does the line # error for the patching, does it match up directly to the orignal file being patched?  If so.. for this instance it's a blank like.  I am quite curious what the issue was though.

 
Average of ratings: -
Picture of Jamie Kramer
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki. Thanks for providing this to the community.

I have a suggestion for making this work better on a Mac.

At about line 47 of ldapname.php you have:

} elseif (stristr(PHP_OS, 'win')) {

This causes the script to detect the running os on a Mac as windows and as such, attempts to use the xcopy command. The reason is that PHP_OS on a mac gets set to Darwin.

I added simple logic so now it looks like this:

if (stristr(PHP_OS, 'Darwin')) {

        system('cp -a "'.$ldap_orig.'" "'.$ldap_new.'"');

} elseif (stristr(PHP_OS, 'win')) {

        $ldap_orig = str_replace('/', '\\', $ldap_orig);

        $ldap_new = str_replace('/', '\\', $ldap_new);

        $ldap_orig_langfile = str_replace('/', '\\', $ldap_orig_langfile);

        $ldap_new_langfile = str_replace('/', '\\', $ldap_new_langfile);

        $patch_file_orig = str_replace('/', '\\', $patch_file_orig);

        system('xcopy "'.$ldap_orig.'" "'.$ldap_new.'" /S /E /I');

} else {

        system('cp -a "'.$ldap_orig.'" "'.$ldap_new.'"');

}

 

Regards,

 

Jamie

 

 
Average of ratings: -
Picture of Jamie Kramer
Re: How to use multiple LDAP servers with Moodle 1.8
 

Also, there is a problem when upgrading a site from say, 2.4 to 2.5. The ldapname script does not seem to set the new ldap name in db/upgrade.php. It is easy enough to fix in the cloned plugin, just by updating db/upgrade.php and replacing ldap with the name of your cloned ldap plugin.

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Jamie,

thanks a lot for your feeback! I have updated the patches for 2.5, 2.6 and master (current as of today). I didn't notice that from 2.5 onwards db/upgrade.php was used, so my patch missed it. I've also added code to detect Darwin as a Unix platform using the same test code that Moodle uses elsewhere.

I'm going to upload the zip files with the patches in separate posts, as there's a limit of two attachments per post (and to make it clearer which zip file corresponds to which Moodle version).

Saludos.
Iñaki.
 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
This is the updated version of the patch for Moodle 2.5.5 onwards.

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
This is the updated version of the patch for Moodle 2.6.2 onwards.

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
This is the updated version of the patch for master 2.7dev (Build: 20140307) or later.

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
This is the updated version of the patch for master 2.8dev (Build: 20140529) or later.

Saludos.
Iñaki.
Picture of Wolfgang Hollauf
Re: How to use multiple LDAP servers with Moodle 1.8
 

Dear Inaki

Build: 20140529 works quite fine in moodle 2.7+ stable version!!! smile

Very nice job!!!!

thank you very much!

wolfgang

 
Average of ratings: -
Picture of ashley savage
Re: How to use multiple LDAP servers with Moodle 1.8
 

good morning, having troubles with this updated patch as-well, tried both and both failed... just crashes patch.exe "This application has requested the Runtime to terminate"... I'm running windows 2008 R2 server MSSQL and IIS 7.5


thanks for all you work on this... been running great with moodle 2.5 and your older patches...


ash 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Ashley,

make sure you follow the instructions from http://docs.moodle.org/dev/How_to_apply_a_patch#Apply_a_Patch_in_Windows_using_gnuwin32

I create the patches on Linux, and the Windows version of patch has a tendency of blowing up when dealing with files using Linux/Unix line endings.

Saludos.
Iñaki.
 
Average of ratings: -
Picture of ashley savage
Re: How to use multiple LDAP servers with Moodle 1.8
 

gday and thanks for your reply, yeah must be doing something wrong... now getting

C:\moodle>patch.exe --dry-run -p1 < ldapname.diff

can't find file to patch at input line 4

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|diff -urN auth/%%LDAPNAME%%/auth.php auth/%%LDAPNAME%%/auth.php

|--- auth/%%LDAPNAME%%/auth.php 2012-12-10 17:02:03.375012706 +0100

|+++ auth/%%LDAPNAME%%/auth.php 2012-12-10 17:02:31.139150376 +0100

--------------------------

File to patch:


can you shed any light ????


thanks again for all your work...

ash

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Ashley,

see this post earlier in this same forum thread: https://moodle.org/mod/forum/discuss.php?d=74279#p752238 smile

Saludos.
Iñaki.
 
Average of ratings: -
Picture of ashley savage
Re: How to use multiple LDAP servers with Moodle 1.8
 

thanks again for all your help, but no love with windows... got the patch.exe working, but now just come up asking for "file to patch" 

thanks again

will keep trying


ash

 
Average of ratings: -
Picture of Wolfgang Hollauf
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Inaki,

i have installed moodle 2.7+ stable and tried out your version 14 and 15 (2.7dev and 2.8dev) -> both are not working!? sad do you have a version for teh stable 2.7+


best

wolfgang

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
This is the updated version of the patch for 2.7+ (Build: 20140529).

Saludos.
Iñaki.
Picture of Miika Lippojoki
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hello Iñaki,


We were upgrading our Moodle to 2.7+ and found your ldap plugin(version 16_27+) very useful when working with multiple domains at our environment. Thank you for the excellent work!

However, we found out that when adding multiple domains to work with, you cannot use upper case letters when naming the ldap plugins with the command php -f ldapname.php.

For example, we tried to make plugin called ldapSCHOOL with command "php -f ldapname.php ldapSCHOOL" and the result was that the folders were created to filesystem but in Moodle the plugin never showed up to the Notifications -page under Site Administration.

After we changed the ldapname to ldapschool, everything worked as it should.

Do you have any idea what was causing this?


Yours,


Miika Lippojoki
ICT-coordinator
Kainuu Vocational College, Finland

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Miika,

I know this answer is a bit late, but the problem is has strict rules on how to name plugins. And they are stricted than I thought they were (it seems the developers made them stricter around Moodle 2.2 but I didn't notice, and didn't update my patch to take them into account).

Currently plugin names can only contain lowercase ASCII letters, numbers and underscores (but numbers and underscores are strongly discouraged by Moodle developers!). And the plugin name must start with a lowercase ASCII letter.

That's why your copy of the plugin didn't show up in the Notifications page: it wasn't considered a valid plugin name, and thus it was completely ignored.

I have update the patch scripts to comply with the rules and reject any plugin name that would be considered invalid by Moodle.

Saludos.
Iñaki.
 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Here are the (updated) patches for Moodle 2.7.3+ and 2.8.1+ current as of today. They already have the stricter plugin name validation rules added.

Saludos.
Iñaki.
Picture of Domenic Silletti
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi,

I tried running the patch for 2.6.2 on a 2.6.5 system (OS is RedHat 6, 64bit) and got numerous "Hunk" errors; is there a specific patch for my system or is there another one I should be using?

Thanks,

Domenic

 
Average of ratings: -
Picture of Domenic Silletti
Re: How to use multiple LDAP servers with Moodle 1.8
 

Update, I ran the 2.6.2 patch again on my system and it ran with no issues.  I now have my Moodle talking to 2 different Active Directory Domains.

 
Average of ratings: -
Picture of Tamas Mako
Tárgy: Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Inaki

I'm using Moodle 2.8.3+ (Build: 20150205) system. I need a multiple LDAP because I have to authenticate from two different domain. I installed your script and the patch process worked fine and I created ldap2 (auth/ldap2). I added correctly to authentication method as well and then I encountered in a weird problem, when I try to login:

Ldap: I can see this address  /auth/ldap/ntlmsso_attempt.php

Attempting Single Sign On via NTLM...

/auth/ldap/ntlmsso_finish.php

Auto-login failed, try the normal login page...


Ldap2: I can see this address  /auth/ldap2/ntlmsso_attempt.php

Attempting Single Sign On via NTLM...

/auth/ldap/ntlmsso_finish.php

Auto-login failed, try the normal login page...

I can see just this running login proccess continuously and I cannot reach the normal login page,


Do you have any idea what caused this problem?

I attached a pic about my auth manager window I think the user don't appear in ldap2 auth.

Kind Reagards
Tom


 
Average of ratings: -
Picture of Michael Lynn
Re: Tárgy: Re: How to use multiple LDAP servers with Moodle 1.8
 

When I tested this on Totara 2.7.6 (Moodle 2.7.9) if NTLM is enabled the problem is in ntlmsso_finish.php

It reaches an end state here:

// If ntlmsso_finish() succeeds, then the code never returns,
// so we only worry about failure.
if (!$authplugin->ntlmsso_finish()) {

// code to redirect with error code

}

I changed my code to then attempt a connection on ldap2.

if (!$authplugin->ntlmsso_finish()) {

     // My Change. try ldap2.
    redirect($CFG->httpswwwroot . '/auth/ldap2/ntlmsso_attempt.php');

}

In ldap2/ntlmsso_finish.php it tries ldap3/ntlmsso_attempt.php etc.

 

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Here are the (updated) patches for Moodle 2.7.7+ and 2.8.4 (that applies cleanly on 2.8.4+ and 2.8.5+ too) current as of today.

Saludos.
Iñaki.
Picture of Waku Worldrings
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hola Iñaki, tengo un problema en Moodle 2.8.5, el script funciona y me duplica el plugin, hasta ahí todo perfecto (bajo centOS).

Me sale esto:


sh: patch: no se encontró la orden


El problema viene que me sale un mensaje de actualizar la base de datos de moodle y al hacerlo me da un error:


La extensión "auth_ldap" está instalado en la ubicación incorrecta "$CFG->dirroot/auth/ldap2"; la ubicación prevista es "$CFG->dirroot/auth/ldap"

Más información sobre este error

Debug info: 
Error code: detectedmisplacedplugin
Stack trace:
  • line 450 of /lib/upgradelib.php: plugin_misplaced_exception thrown
  • line 1626 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 434 of /admin/index.php: call to upgrade_noncore()

In my bad English:

when i run your script, i get some errors, the first is "sh: patch: command not found"


And later when i enter to administration panel of moodle, a message appears whit the error that i have posted above.


Thank you for your free support to all us Iñaki.


Edito /edit:


He instalado patch y me da el siguiente error

i have instaled patch and now i have this error:


Hunk #1 FAILED at 25.

1 out of 1 hunk FAILED -- saving rejects to file auth/ldap2/version.php.rej

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

Hola Waku,

¿qué versión exacta de Moodle tienes? (la puedes encontrar en el fichero version.php). Es para intentar reproducir el problema (ya que dependiendo de la versión, puede haber más o menos cambios en el área que toca el parche).

English version:

What exact Moodle version do you have? (you can find that our in version.php file). This will help me reproduce the problema (depending on the Moodle version, there can be more or less changes in the area affected by the patch)

Saludos. Iñaki.

 
Average of ratings: -
Picture of Waku Worldrings
Re: How to use multiple LDAP servers with Moodle 1.8
 

ante todo, Muchas gracias por responder y querer ayudarme.

El archivo php contiene lo siguiente:


defined('MOODLE_INTERNAL') || die();


$version  = 2014111005.00;              // 20141110      = branching date YYYYMMDD - do not modify!

                                        //         RR    = release increments - 00 in DEV branches.

                                        //           .XX = incremental changes.


$release  = '2.8.5 (Build: 20150310)'; // Human-friendly version name


$branch   = '28';                       // This version's branch.

$maturity = MATURITY_STABLE;             // This version's maturity level.


Muchas gracias.

 
Average of ratings: -
Picture of Waku Worldrings
Re: How to use multiple LDAP servers with Moodle 1.8
 

El problema que no me había modificado el archivo versions.php, lo he modificado a mano cambiando $plugin->component = 'auth_ldap'; 

a $plugin->component = 'auth_ldap2'; 


Ese era el problema en mi caso, un saludo.

 
Average of ratings: -
Picture of Anthony Cascianelli
Re: How to use multiple LDAP servers with Moodle 1.8
 

Does anyone know if this patch works for Moodle 2.9+?

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
If you use the attached file, it should smile

Saludos.
Iñaki.
Picture of Nicolas REI
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hello Inaki,


Thank's for your Patch.

I use this patch on mooble created by Bitnami and server 2012 R2.

My problem is the same of Pandiarajan : Error1.jpg


And no solution in this page.

If you have and idea...

Sorry for my English :/


Server 2012R2 Moodle 2.9.1 Patch 2.9+

Merci ;)

Nicolas


 
Average of ratings: -
Picture of Nicolas REI
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hello,

i have the solution, just not good format for the patch, now it's good, thank you.


Nico

 
Average of ratings: -
Picture of Wendy Gordon
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hello Iñaki

Thank you for such a great patch. Has a version been done for 2.8.7.

Gracias

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Wendy,

this version should work with 2.8.7+ (Build: 20150820).

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
It seems I forgot to include ldapname.diff in the previous .zip file (thanks Wendy for the heads up!).

This new .zip file includes all the necessary files.

Saludos
Iñaki.
 
Picture of Денис Васильев
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi inaki

Thank you for patch. Has a version been done for 3+?

 
Average of ratings: -
Picture of Daniel Velazquez
Re: How to use multiple LDAP servers with Moodle 1.8
 
Hi iñaki my Moodle version it's 2.8.7+ I make all the instructions but when I tried to save de changes in the new server LDAP I can't, Here all the details about versión of my Moodle.

defined('MOODLE_INTERNAL') || die();


$version  = 2014111007.02;              // 20141110      = branching date YYYYMMDD - do not modify!

                                        //         RR    = release increments - 00 in DEV branches.

                                        //           .XX = incremental changes.


$release  = '2.8.7+ (Build: 20150716)'; // Human-friendly version name


$branch   = '28';                       // This version's branch.

$maturity = MATURITY_STABLE;             // This version's maturity level.

Saludos.


 
Average of ratings: -
Picture of Noveck Gowandan
Re: How to use multiple LDAP servers with Moodle 1.8
 

Good day fellow Moodlers,

Are there any plans to port this mod over to Moodle 3?

Thanks for all that you guys do!

Regards,
Noveck

 
Average of ratings: -
Picture of Emma Richardson
Re: How to use multiple LDAP servers with Moodle 1.8
Group Documentation writersGroup Particularly helpful Moodlers

I just copied over the cloned folder and it is running just fine on 3.0.

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Noveck,

The attached patch applies cleanly to 3.0.1, 3.0.2 and 3.0.3 (current as of today). And with some offset warnings to 3.0 (but still working ok).

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
It seems a small bug slipped in the previous version of the patch fro 3.0.x. It's harmless if you only create a single additional LDAP auth plugin clone, but it screws things up if you use more than one.

The attached .zip file fixes the bug.

Saludos.
Iñaki.
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi,

the attached patch applies cleanly to Moodle 3.1+ (Build: 20160701). It should apply cleanly to any 3.1 version published so far.

Saludos.
Iñaki.
Picture of Saravanan PP
Re: How to use multiple LDAP servers with Moodle 1.8
 

Dear Iñaki,


I have tried this version (ldap-clones-patch-script_3.0+_v2.zip) in my moodle server version 3.0. I am getting the following error when I try this patch.


[E6320@Qmoodles moodle_30]$ php -f ldapname.php ldaptmtl

!!! <p>Error: database driver problem detected</p>

<p>The site administrator should verify server configuration</p><p>PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP.</p> !!!


My moodle application is working fine without this MySQLi extension moodle will not function.


Kindly help


Regards,

Saravanan P

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Saravanan,

the error is probably due to the PHP command line interface configuration (php.ini) being different than your PHP web server module configuration (they sometimes use different configuration files for each of them).

Make sure you use the same configuration settings in both cases, and that you execute the command at the top of your Moodle installation directory.

Saludos.
Iñaki.
 
Average of ratings: -
Picture of Michael Lynn
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki,

Just to let you know that ldap-clones-patch-scriptv16_27+.zip works perfectly with Totara 2.7.6 (Moodle 2.7.9). Thank you!

Regards,

Michael.

 

 
Average of ratings: -
Picture of Tomas De Amos
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki.

First of all I want to thank you for your contribution.

I am using Moodle 3.1 and was able to apply the patch.

The additional auth plugin was generated and I was able to install it, activate and configure it.

The issue I`m facing now is that I am not sure if I need to add a scheduled task for this in order to syncronize. When I execute the cron job I only see messages for the first original plugin, but not from the second one added. Is this task necesarry? If yes, How can I add it?

In Scheduled tasks I only see this:

LDAP users sync job \auth_ldap\task\sync_task

This is what I see on cron execution:

Execute scheduled task: Trabajo de sincronización de usuarios LDAP (auth_ldap\task\sync_task)
... started 19:59:10. Current memory use 20.5MB.
Conectando con el servidor LDAP ...Creando la tabla temporal tmp_extuser..Obtenidos 2 registros de LDAPNo hay actualizaciones disponiblesNo hay entradas de usuarios para agregar... used 8 dbqueries
... used 0.56359791755676 seconds
Scheduled task complete: Trabajo de sincronización de usuarios LDAP (auth_ldap\task\sync_task)

Am I missing any configuration?

Thanks in advance for your help.

Tomas.

 
Average of ratings: -
Picture of Emma Richardson
Re: How to use multiple LDAP servers with Moodle 1.8
Group Documentation writersGroup Particularly helpful Moodlers

Yes, your duplicated ldap plugin will not be run through scheduled tasks.  You will need to set up a separate cron job on your server if you want it to sync automatically.

 
Average of ratings: -
Picture of Tomas De Amos
Re: How to use multiple LDAP servers with Moodle 1.8
 

Thanks Emma for your prompt reply.

Excuse me for my ignorance: Can you point me to a document which specifies the steps to set up a separate cron job?

Regards.

Tomas.

 
Average of ratings: -
Picture of Emma Richardson
Re: How to use multiple LDAP servers with Moodle 1.8
Group Documentation writersGroup Particularly helpful Moodlers

That would depend on your server...at some point, you set up a cron job that pointed to admin/cli/cron.php or something similar.  Now you need add another line to that pointing to the sync.php or sync_users.php in your duplicated ldap plugin.

 
Average of ratings: -
Picture of Tomas De Amos
Re: How to use multiple LDAP servers with Moodle 1.8
 

Thanks again Emma.

With your instructions I was able to execute the sincronization script directly from cli folder of the new LDAP plugin that I had generated.

Regards.

Tomas.

 
Average of ratings: -
Picture of Iñaki Arenaza
Re: How to use multiple LDAP servers with Moodle 1.8
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers
Hi Tomas,

you are not missing any configuration, as Emma has pointed out.

On the other hand, it turns out that I didn't notice that the patch was failing to take into account the new scheduled tasks sub-system files. So the scheduled tasks were not being created for the cloned plugins.

I have updated the patch to take that into account. Bear in mind that the cloned plugin scheduled tasks are only created during plugin installation (that's the way Moodle behaves, not something patch-specific). So this won't benefit existing users much (unless you backup your cloned plugin settings, uninstall it, re-install it and restore your plugin settings).

I'm attaching updated patches for Moodle 3.1+ (current as of today), and Moodle master. I'll upload and update version for Moodle 3.0+ in a few hours.

Saludos.
Iñaki.
Picture of Tomas De Amos
Re: How to use multiple LDAP servers with Moodle 1.8
 

Thanks for your help Iñaki !

Regards.

Tomas.

 
Average of ratings: -
Picture of Michael Lynn
Re: How to use multiple LDAP servers with Moodle 1.8
 

We are successfully using the clone script with Totara 2.7.6 (Moodle 2.7.9). It works really well.


A problem we have is that sometimes users have duplicate names in the different domains:

Example (names anonymised):

ldap - domain1\jsmith1 (Jonathan Smith)

ldap2 - domain2\jsmith1 (James Smith)

Jonathan Smith logs in and their account in Moodle is created.

When James Smith comes along their account isn't created in Moodle and they are logged in as Jonathan Smith.


This is because the username must be unique.

Question 1:

Am I right in saying that there is no way to map or modify the username created to include some other attribute e.g. country code in the Moodle username?

It might solve the problem if the username was generated with the country code as a prefix:

e.g. uk_jsmith1, us_jsmith1 etc.

We are using NTLM so the username is derived from SAMAccountName.


I can't see how we could even customise the authentication plugin because in auth.php in user_signup() $user->username is already populated with no access to other properties such as countrycode (mapped to c in the Active Directory attributes).


 
Average of ratings: -
Picture of Dom Northeast
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki.,

Thank you for a most useful addition to Moodle, I have been using it successfully for the last couple of years. 


I hope you can assist. I recently upgraded our Moodle to 2.9+ (Build: 20150604) and have attempted to apply your 2.9+ patch but am coming up with a patch error as attached. The server is Centos 6.7. 

Kind Regards

Dominique Northeast




Picture of Dom Northeast
Re: How to use multiple LDAP servers with Moodle 1.8
 

Hi Iñaki,

Please ignore my previous request for assistance. I have figured out what I was doing wrong (my own fault as might be expected). I simply needed to cd to the moodle root directory before applying the patch. Once done the patch installed fine.

I had bit of a conflict with the installed version; I was getting a database upgrade error saying:

auth_ldap2

Cannot downgrade auth_ldap from 2015051100 to 2014111001.


However, once I modified the version dates in /auth/ldap2/db/upgrade.php from the older date to the newer, it installed fine and is working as perfectly as ever.


Regards

Dominique Northeast

 
Average of ratings: Useful (1)