57        $this->server_id = $a_server_id;
 
   70        if (array_key_exists($a_server_id, self::$instances) and is_object(self::$instances[$a_server_id])) {
 
   71            return self::$instances[$a_server_id];
 
   84    public static function _delete($a_server_id)
 
   90        $query = 
"DELETE FROM ldap_attribute_mapping " .
 
   91            "WHERE server_id =" . 
$ilDB->quote($a_server_id, 
'integer');
 
  108        $query = 
"SELECT value FROM ldap_attribute_mapping " .
 
  109            "WHERE server_id =" . 
$ilDB->quote($a_server_id, 
'integer') . 
" " .
 
  110            "AND keyword = " . 
$ilDB->quote(
'global_role', 
'text');
 
  114            return (
int) $row->value;
 
  131        $query = 
'SELECT perform_update FROM ldap_attribute_mapping ' .
 
  132            'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
 
  133            'AND perform_update = 1';
 
  135        return $res->numRows() ? true : 
false;
 
  147    public function setRule($a_field_name, $a_ldap_attribute, $a_perform_update)
 
  149        $this->mapping_rules[$a_field_name][
'value'] = $a_ldap_attribute;
 
  150        $this->mapping_rules[$a_field_name][
'performUpdate'] = $a_perform_update;
 
  162        return $this->rules_for_update ? $this->rules_for_update : array();
 
  174        foreach ($this->rules_for_update as $field => $rule) {
 
  175            if (!strlen($rule[
'value'])) {
 
  178            if (strpos($rule[
'value'], 
',') === 
false) {
 
  179                $fields[] = strtolower($rule[
'value']);
 
  182            $tmp_fields = explode(
',', $rule[
'value']);
 
  184            foreach ($tmp_fields as $tmp_field) {
 
  185                $fields[] = trim(strtolower($tmp_field));
 
  188        return $fields ? $fields : array();
 
  200        foreach ($this->mapping_rules as $field => $rule) {
 
  201            if (!strlen($rule[
'value'])) {
 
  204            if (strpos($rule[
'value'], 
',') === 
false) {
 
  205                $fields[] = strtolower($rule[
'value']);
 
  208            $tmp_fields = explode(
',', $rule[
'value']);
 
  210            foreach ($tmp_fields as $tmp_field) {
 
  211                $fields[] = trim(strtolower($tmp_field));
 
  214        return $fields ? $fields : array();
 
  237        $this->mapping_rules = array();
 
  254        foreach ($this->mapping_rules as $keyword => $options) {
 
  255            $query = 
"INSERT INTO ldap_attribute_mapping (server_id,keyword,value,perform_update) " .
 
  257                $this->db->quote($this->server_id, 
'integer') . 
", " .
 
  258                $this->db->quote($keyword, 
'text') . 
", " .
 
  259                $this->db->quote($options[
'value'], 
'text') . 
", " .
 
  260                $this->db->quote($options[
'performUpdate'], 
'integer') .
 
  272    public function delete()
 
  287        if (array_key_exists($a_field_name, $this->mapping_rules)) {
 
  288            return (
bool) $this->mapping_rules[$a_field_name][
'performUpdate'];
 
  302        if (array_key_exists($a_field_name, $this->mapping_rules)) {
 
  303            return $this->mapping_rules[$a_field_name][
'value'];
 
  321        $query = 
"SELECT * FROM ldap_attribute_mapping " .
 
  322            "WHERE server_id =" . $this->db->quote($this->server_id, 
'integer') . 
" ";
 
  326            $this->mapping_rules[$row->keyword][
'value'] = $row->value;
 
  327            $this->mapping_rules[$row->keyword][
'performUpdate'] = (bool) $row->perform_update;
 
  329            if ($row->perform_update) {
 
  330                $this->rules_for_update[$row->keyword][
'value'] = $row->value;
 
An exception for terminatinating execution or to throw for unit testing.
This class stores the settings that define the mapping between LDAP attribute and user profile fields...
getFields()
Get all mapping fields.
setRule($a_field_name, $a_ldap_attribute, $a_perform_update)
Set mapping rule.
enabledUpdate($a_field_name)
Check whether an update should be performed on a specific user attribute or not.
static hasRulesForUpdate($a_server_id)
Check if there is ldap attribute -> user data mapping which which is updated on login.
getValue($a_field_name)
Get LDAP attribute name by given ILIAS profile field.
__construct($a_server_id)
Private constructor (Singleton for each server_id)
clearRules()
Clear rules => Does not perform an update.
getRulesForUpdate()
Get all mapping rules with option 'update'.
save()
Save mapping rules to db.
static _delete($a_server_id)
Delete mapping rules by server id.
static _lookupGlobalRole($a_server_id)
Lookup global role assignment.
getFieldsForUpdate()
Get field names of all mapping rules with option 'update'.
read()
Read mapping setttings from db.
static _getInstanceByServerId($a_server_id)
Get instance of class.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
foreach($_POST as $key=> $value) $res