+ Post New Thread
Results 1 to 13 of 13
Virtual Learning Platforms Thread, moodle ldap default values if not set by AD in Technical; I have got moodle integrated into AD but what want to do is set some fields like location and country ...
  1. #1

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,946
    Thank Post
    709
    Thanked 553 Times in 368 Posts
    Blog Entries
    3
    Rep Power
    204

    moodle ldap default values if not set by AD

    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

  2. #2
    fooby's Avatar
    Join Date
    Dec 2005
    Posts
    351
    Thank Post
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    19

    Re: moodle ldap default values if not set by AD

    Half-code fooby-madeup

    Code:
    if exist value for location in active directory
    set location == active_directory(location)
    else 
    set location == "default_location"
    end if
    (not real code)

    Is this the logic you are looking for?

    There is a line in the Data Mapping section that states

    If you leave these fields blank, then nothing will be transferred from LDAP and Moodle defaults will be used instead.
    however where these "defaults" are I couldn't find in my install.

    I have included the data mapping settings from my setup here

    fooby
    Attached Files Attached Files

  3. #3
    alan-d's Avatar
    Join Date
    Aug 2005
    Location
    Sutton Coldfield
    Posts
    2,421
    Thank Post
    360
    Thanked 258 Times in 189 Posts
    Rep Power
    76

    Re: moodle ldap default values if not set by AD

    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 

  4. #4
    fooby's Avatar
    Join Date
    Dec 2005
    Posts
    351
    Thank Post
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    19

    Re: moodle ldap default values if not set by AD

    If any of my line managers ask, alan-d said I can go home!

    woo!!

    fooby

  5. #5
    Wildebeaste's Avatar
    Join Date
    Oct 2006
    Location
    Nottinghamshire
    Posts
    64
    Thank Post
    12
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    AD attributes not transfering into Moodle

    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.

  6. #6
    Jona's Avatar
    Join Date
    May 2007
    Location
    Cranleigh
    Posts
    471
    Thank Post
    14
    Thanked 51 Times in 49 Posts
    Rep Power
    24
    Quote Originally Posted by Wildebeaste View Post
    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.

  7. #7
    andyrite's Avatar
    Join Date
    Apr 2007
    Posts
    417
    Thank Post
    7
    Thanked 91 Times in 72 Posts
    Rep Power
    42
    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.

  8. #8

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,808
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    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.

  9. #9

    Join Date
    May 2010
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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

  10. #10

    Join Date
    Jan 2010
    Posts
    64
    Thank Post
    7
    Thanked 5 Times in 5 Posts
    Rep Power
    10
    Quote Originally Posted by russdev View Post
    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
    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 10:40 AM.

  11. #11

    Join Date
    Jan 2010
    Posts
    64
    Thank Post
    7
    Thanked 5 Times in 5 Posts
    Rep Power
    10
    Quote Originally Posted by Wildebeaste View Post
    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.
    First name: givenName
    Surname: sn
    Email address: mail

    Make sure the accounts have first name and last name filled in when you view them in ad users and computers!

  12. #12

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,808
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    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.

  13. #13

    Join Date
    May 2010
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Cheers for your help guys, all seems OK now.

    Regards

SHARE:
+ Post New Thread

Similar Threads

  1. Moodle and LDAP Security Concerns
    By Optimus in forum How do you do....it?
    Replies: 3
    Last Post: 10th December 2007, 06:28 PM
  2. PHP and LDAP on IIS
    By srochford in forum Windows
    Replies: 2
    Last Post: 31st October 2007, 09:05 AM
  3. Moodle and LDAP
    By GrumbleDook in forum Virtual Learning Platforms
    Replies: 10
    Last Post: 28th March 2007, 04:02 PM
  4. Moodle LDAP Enrolment
    By Mike_R in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 6th December 2006, 02:33 PM
  5. ADM Template to set hkey_users.default reg values
    By ryan_powell in forum Windows
    Replies: 1
    Last Post: 2nd December 2006, 08:38 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •