[svn r15253] Field addition to the database and changes to LDAP code to fix field filtering (by Arnaud)

skala
Yannick Warnier 17 years ago
parent 7df7b8f2ae
commit 9e07e548e9
  1. 31
      main/auth/ldap/authldap.php
  2. 3
      main/install/dokeos_main.sql
  3. 2
      main/install/migrate-db-1.8.4-1.8.5-pre.sql

@ -1,4 +1,4 @@
<?php // $Id: authldap.php 14997 2008-04-22 01:33:31Z yannoo $
<?php // $Id: authldap.php 15253 2008-05-09 03:00:19Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -47,6 +47,7 @@
version history
---------------
3.2 - updated to allow for specific term search for teachers identification
3.1 - updated code to use database settings, to respect coding conventions as much as possible (camel-case removed) and to allow for non-anonymous login
3.0 - updated to use ldap_var.inc.php instead of ldap_var.inc (deprecated)
(November 2003)
@ -182,7 +183,8 @@ function ldap_find_user_info ($login)
$result["firstname"] = $info[0]["givenname"][0];
$result["name"] = $info[0]["sn"][0];
$result["email"] = $info[0]["mail"][0];
$result["employeenumber"] = $info[0]["employeenumber"][0];
$tutor_field = api_get_setting('ldap_filled_tutor_field');
$result[$tutor_field] = $info[0][$tutor_field]; //employeenumber by default
return $result;
}
@ -221,20 +223,37 @@ function ldap_put_user_info_locally($login, $info_array)
define ("COURSEMANAGER",1);
$tutor_field = api_get_setting('ldap_filled_tutor_field');
$tutor_value = api_get_setting('ldap_filled_tutor_field_value');
if(empty($tutor_field))
{
$status = STUDENT;
}
else
{
if (empty($info_array[$tutor_field]))
if(empty($tutor_value))
{
$status = STUDENT;
//in this case, we are assuming that the admin didn't give a criteria
// so that if the field is not empty, it is a tutor
if(!empty($info_array[$tutor_field]))
{
$status = COURSEMANAGER;
}
else
{
$status = STUDENT;
}
}
else
{
$status = COURSEMANAGER;
//$official_code = $info_array['employeenumber'];
//the tutor_value is filled, so we need to check the contents of the LDAP field
if (is_array($info_array[$tutor_field]) && in_array($tutor_value,$info_array[$tutor_field]))
{
$status = COURSEMANAGER;
}
else
{
$status = STUDENT;
}
}
}
//$official_code = xxx; //example: choose an attribute

@ -557,7 +557,8 @@ VALUES
('extendedprofile_registrationrequired', 'mycomptetences', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyCompetences'),
('extendedprofile_registrationrequired', 'mydiplomas', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyDiplomas'),
('extendedprofile_registrationrequired', 'myteach', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyTeach'),
('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea');
('extendedprofile_registrationrequired', 'mypersonalopenarea', 'checkbox','User','false', 'ExtendedProfileRegistrationRequiredTitle','ExtendedProfileRegistrationRequiredComment', NULL, 'MyPersonalOpenArea'),
('ldap_filled_tutor_field_value', NULL, 'textfield', 'LDAP', '', 'LDAPFilledTutorFieldValueTitle', 'LDAPFilledTutorFieldValueComment', NULL, '');
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;

@ -102,6 +102,8 @@ ALTER TABLE settings_current ADD COLUMN access_url_changeable int unsigned not n
ALTER TABLE settings_current ADD INDEX (access_url);
CREATE TABLE access_url(id int unsigned NOT NULL auto_increment, url varchar(255) NOT NULL default 'http://localhost/', description text, active int unsigned not null default 0, created_by int not null, tms TIMESTAMP, PRIMARY KEY (id));
INSERT INTO access_url(url,description,active,created_by) VALUES ('http://localhost/','URL 1',1,1);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext) VALUES ('ldap_filled_tutor_field_value', NULL, 'textfield', 'LDAP', '', 'LDAPFilledTutorFieldValueTitle', 'LDAPFilledTutorFieldValueComment', NULL, '');
-- xxSTATSxx
ALTER TABLE track_e_downloads ADD INDEX (down_user_id);

Loading…
Cancel
Save