Forums | Mahara Community

Developers /
Some trouble with auth/ldap/AuthPlugin


anonymous profile picture
Account deleted
Posts: 26

15 December 2011, 9:15

Hello,

   I am trying to implement some nightly cli cron scripts that would synchronize Mahara institutions, groups and users with an LDAP directory, like those that exist with Moodle .

   The obvious solution is to write a 'Group Aware' AuthLdap class extending current auth/ldap/AuthLdap and add to it some methods to scan an LDAP server for groups and group members. This will be better than modifying 'core' class. 

   Unfortunately some methods of AuthLdap class are declared 'private' and thus cannot be called by child classes. I am thinking of ldap_connect() , filter_addslashes() and ldap_get_entries(). I guess that making them protected instead of private would be break too much security. 

 

Cheers.

François Marier's profile picture
Posts: 411

15 December 2011, 16:07

Hi Patrick,

I don't think that these methods are private for security purposes. Instead they're probably like that because the LDAP plugin wasn't designed with inheritance in mind. You can probably change them to protected on your site and see what happens. I suspect it'll work just fine.

An alternative approach to what you are suggesting, if you want to work to integrate your extra functionality in core Mahara, would be to extend the existing plugin in a way that one doesn't have to use the extra functionality. Then you could submit it for review and inclusion in core.

Feel free to get in touch with us if you want some guidance on this and/or if you'd like us to review your overall approach/design.

Cheers,

Francois

anonymous profile picture
Account deleted
Posts: 26

16 December 2011, 7:50

Hi Francois,

   I did made the change from private to protected in my local copy and it does work as expected ;-)

   I do not like playing around with 'core files' ; my previous experience with Moodle was bad, especially when they moved from 1.9 to 2.x.... that why I suggest a minor change in a core file auth/ldap/lib.php that will help me and possibly others to write  child classes that would be available only to those using my 'plugin'

  All the LDAP fetching part is now operational and I am now peeking into Mahara code to find the best way to cleany add groups, groupings and register/unregister  users into them, taking in account that they may be in some institutions and not be 'global'  . Thanks for your offer since that part is going to be the trickest one ...

Cheers ( et Joyeuses Fêtes de fin d'année) 

 

3 results