@@ -360,7 +360,7 @@ function process_config($config) {
360
360
* @return boolean result
361
361
*/
362
362
function iscreator ($ username ) {
363
- if ((empty ($ this ->config ->attrcreators ) && empty ($ this ->config ->groupecreators )) or empty ($ this ->config ->memberattribute )) {
363
+ if (empty ( $ this -> config -> host_url ) or (empty ($ this ->config ->attrcreators ) && empty ($ this ->config ->groupecreators )) or empty ($ this ->config ->memberattribute )) {
364
364
return false ;
365
365
}
366
366
@@ -405,4 +405,39 @@ function iscreator($username) {
405
405
406
406
return false ;
407
407
}
408
+
409
+ /**
410
+ * Reads user information from LDAP and returns it as array()
411
+ *
412
+ * If no LDAP servers are configured, user information has to be
413
+ * provided via other methods (CSV file, manually, etc.). Return
414
+ * an empty array so existing user info is not lost. Otherwise,
415
+ * calls parent class method to get user info.
416
+ *
417
+ * @param string $username username
418
+ * @return mixed array with no magic quotes or false on error
419
+ */
420
+ function get_userinfo ($ username ) {
421
+ if (empty ($ this ->config ->host_url )) {
422
+ return array ();
423
+ }
424
+ return parent ::get_userinfo ($ username );
425
+ }
426
+
427
+ /**
428
+ * Syncronizes users from LDAP server to moodle user table.
429
+ *
430
+ * If no LDAP servers are configured, simply return. Otherwise,
431
+ * call parent class method to do the work.
432
+ *
433
+ * @param bool $do_updates will do pull in data updates from LDAP if relevant
434
+ * @return nothing
435
+ */
436
+ function sync_users ($ do_updates =true ) {
437
+ if (empty ($ this ->config ->host_url )) {
438
+ error_log ('[AUTH CAS] ' .get_string ('noldapserver ' , 'auth_cas ' ));
439
+ return ;
440
+ }
441
+ parent ::sync_users ($ do_updates );
442
+ }
408
443
}
0 commit comments