
I have got moodle integrated into AD but what want to do is set some fields like location and country to default if not set in activedir does that make sense.
Russ
Half-code fooby-madeup
(not real code)Code:if exist value for location in active directory set location == active_directory(location) else set location == "default_location" end if
Is this the logic you are looking for?
There is a line in the Data Mapping section that states
however where these "defaults" are I couldn't find in my install.If you leave these fields blank, then nothing will be transferred from LDAP and Moodle defaults will be used instead.
I have included the data mapping settings from my setup here
fooby
or
PHP Code:if exist value for location in active directory
set location == active_directory(location)
else
set location == "go home - it's friday anyway"
end if
![]()
If any of my line managers ask, alan-d said I can go home!
woo!!
fooby
I've often had a problem with AD attributes transfering into Moodle.
I'm setting up a new Moodle server (1.9) and LDAP auth works fine. Everyone can log on using their AD uername. However, I can't get the first name and surname attributes into Moodle.
'givenName', 'displayName' and 'sn' just put the log-on name (equivalent of 'sAMAccountName') into the fields. Other AD attributes such as 'mail', 'userPrincipleName' or 'sAMAccountName' put the appropriate information in.
Am I missing something simple? I would've thought that if LDAP was authenticating properly, then these attributes would 'just work'.
Any advice?
Ta.
Use this utility to browse your ldap server http://www-unix.mcs.anl.gov/~gawor/ldap/ and see if you can locate the fields required.
http://www.computerperformance.co.uk..._directory.htm
sn should be the surname. Don't understand why thats not working. I import all my users with a csv file and set them to ldap as authentication. Bit of a long way round but it gets my fields populated as I want.
The LDAP fields will only work if the LDAP user moodle is using to connect can update the fields on the LDAP server. Mere 'Domain User' access is insufficient for this.
Hi Guys.
Any ideas...
I too am trying to use the Data Mapping, my Bind user is Dom Admin so priviledges should be sufficient. However, when changing the LDAP fields to eg. 'givenName', 'sn' etc it refuses to save.
Well, not refuses, but saves and deletes all the entries. It refuses to keep the changes. Other changes work fine.
Are there any pre requisites to enable data mapping changes from default?
regards
It's easy to do, but you need to remember to edit the code after every update.
edit: moodle\auth\ldap\auth.php
search for :
function get_userinfo($username) {
at end of this you will see :
$this->ldap_close();
return $result;
add before :
$result['country'] = 'GB';
$result['city'] = 'CHANGE TO WHAT YOU WANT';
Last edited by zbjsy; 8th June 2010 at 11:40 AM.
Yes, ensure your AD is filled out with the correct info. If not you can get either moodle to ask the user to fill it out, or better yet, bulk import the data into AD on the windows side and just have moodle update it when users log in.
Cheers for your help guys, all seems OK now.
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)