This class stores the settings that define the mapping between LDAP attribute and user profile fields. More...
Collaboration diagram for ilLDAPAttributeMapping:Public Member Functions | |
| setRule ($a_field_name, $a_ldap_attribute, $a_perform_update) | |
| Set mapping rule. | |
| getRulesForUpdate () | |
| Get all mapping rules with option 'update'. | |
| getFieldsForUpdate () | |
| Get field names of all mapping rules with option 'update'. | |
| getFields () | |
| Get all mapping fields. | |
| getRules () | |
| Get all rules. | |
| clearRules () | |
| Clear rules => Does not perform an update. | |
| save () | |
| Save mapping rules to db. | |
| delete () | |
| Delete all entries. | |
| enabledUpdate ($a_field_name) | |
| Check whether an update should be performed on a specific user attribute or not. | |
| getValue ($a_field_name) | |
| Get LDAP attribute name by given ILIAS profile field. | |
Static Public Member Functions | |
| static | _getInstanceByServerId ($a_server_id) |
| Get instance of class. | |
| static | _delete ($a_server_id) |
| Delete mapping rules by server id. | |
| static | _lookupGlobalRole ($a_server_id) |
| Lookup global role assignment. | |
Private Member Functions | |
| __construct ($a_server_id) | |
| Private constructor (Singleton for each server_id). | |
| read () | |
| Read mapping setttings from db. | |
Private Attributes | |
| $server_id = null | |
| $db = null | |
| $mapping_rules = array() | |
| $rules_for_update = array() | |
| $lng | |
Static Private Attributes | |
| static | $instances = array() |
This class stores the settings that define the mapping between LDAP attribute and user profile fields.
Definition at line 33 of file class.ilLDAPAttributeMapping.php.
| ilLDAPAttributeMapping::__construct | ( | $ | a_server_id | ) | [private] |
Private constructor (Singleton for each server_id).
private
Definition at line 48 of file class.ilLDAPAttributeMapping.php.
{
global $ilDB,$lng;
$this->db = $ilDB;
$this->lng = $lng;
$this->server_id = $a_server_id;
$this->read();
}
Here is the call graph for this function:| static ilLDAPAttributeMapping::_delete | ( | $ | a_server_id | ) | [static] |
Delete mapping rules by server id.
public
| int | server id |
Definition at line 82 of file class.ilLDAPAttributeMapping.php.
References $res.
Referenced by delete().
{
global $ilDB;
$query = "DELETE FROM ldap_attribute_mapping ".
"WHERE server_id =".$ilDB->quote($a_server_id);
$res = $ilDB->query($query);
}
Here is the caller graph for this function:| static ilLDAPAttributeMapping::_getInstanceByServerId | ( | $ | a_server_id | ) | [static] |
Get instance of class.
public
| int | server_id |
Definition at line 65 of file class.ilLDAPAttributeMapping.php.
Referenced by ilLDAPQuery::__construct(), ilLDAPServer::getPearAtributeArray(), ilLDAPSettingsGUI::initAttributeMapping(), and ilLDAPAttributeToUser::initLDAPAttributeMapping().
{
if(array_key_exists($a_server_id,self::$instances) and is_object(self::$instances[$a_server_id]))
{
return self::$instances[$a_server_id];
}
return self::$instances[$a_server_id] = new ilLDAPAttributeMapping($a_server_id);
}
Here is the caller graph for this function:| static ilLDAPAttributeMapping::_lookupGlobalRole | ( | $ | a_server_id | ) | [static] |
Lookup global role assignment.
public
Definition at line 98 of file class.ilLDAPAttributeMapping.php.
References $res.
Referenced by ilLDAPRoleAssignments::fetchDefaultRole(), and ilLDAPSettingsGUI::prepareRoleSelect().
{
global $ilDB;
$query = "SELECT value FROM ldap_attribute_mapping ".
"WHERE server_id =".$ilDB->quote($a_server_id)." ".
"AND keyword = ".$ilDB->quote('global_role');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return (int) $row->value;
}
return 0;
}
Here is the caller graph for this function:| ilLDAPAttributeMapping::clearRules | ( | ) |
Clear rules => Does not perform an update.
public
Definition at line 219 of file class.ilLDAPAttributeMapping.php.
{
$this->mapping_rules = array();
}
| ilLDAPAttributeMapping::delete | ( | ) |
Delete all entries.
public
Definition at line 251 of file class.ilLDAPAttributeMapping.php.
References _delete().
{
self::_delete($this->server_id);
}
Here is the call graph for this function:| ilLDAPAttributeMapping::enabledUpdate | ( | $ | a_field_name | ) |
Check whether an update should be performed on a specific user attribute or not.
public
| string | ILIAS user attribute |
Definition at line 264 of file class.ilLDAPAttributeMapping.php.
{
if(array_key_exists($a_field_name,$this->mapping_rules))
{
return (bool) $this->mapping_rules[$a_field_name]['performUpdate'];
}
return false;
}
| ilLDAPAttributeMapping::getFields | ( | ) |
Get all mapping fields.
public
Definition at line 178 of file class.ilLDAPAttributeMapping.php.
{
foreach($this->mapping_rules as $field => $rule)
{
if(!strlen($rule['value']))
{
continue;
}
if(strpos($rule['value'],',') === false)
{
$fields[] = strtolower($rule['value']);
continue;
}
$tmp_fields = explode(',',$rule['value']);
$value = '';
foreach($tmp_fields as $tmp_field)
{
$fields[] = trim(strtolower($tmp_field));
}
}
return $fields ? $fields : array();
}
| ilLDAPAttributeMapping::getFieldsForUpdate | ( | ) |
Get field names of all mapping rules with option 'update'.
public
Definition at line 148 of file class.ilLDAPAttributeMapping.php.
{
foreach($this->rules_for_update as $field => $rule)
{
if(!strlen($rule['value']))
{
continue;
}
if(strpos($rule['value'],',') === false)
{
$fields[] = strtolower($rule['value']);
continue;
}
$tmp_fields = explode(',',$rule['value']);
$value = '';
foreach($tmp_fields as $tmp_field)
{
$fields[] = trim(strtolower($tmp_field));
}
}
return $fields ? $fields : array();
}
| ilLDAPAttributeMapping::getRules | ( | ) |
Get all rules.
public
Definition at line 208 of file class.ilLDAPAttributeMapping.php.
{
return $this->mapping_rules;
}
| ilLDAPAttributeMapping::getRulesForUpdate | ( | ) |
Get all mapping rules with option 'update'.
public
Definition at line 136 of file class.ilLDAPAttributeMapping.php.
{
return $this->rules_for_update ? $this->rules_for_update : array();
}
| ilLDAPAttributeMapping::getValue | ( | $ | a_field_name | ) |
Get LDAP attribute name by given ILIAS profile field.
public
| string | ILIAS user attribute |
Definition at line 280 of file class.ilLDAPAttributeMapping.php.
{
if(array_key_exists($a_field_name,$this->mapping_rules))
{
return $this->mapping_rules[$a_field_name]['value'];
}
return '';
}
| ilLDAPAttributeMapping::read | ( | ) | [private] |
Read mapping setttings from db.
private
Definition at line 296 of file class.ilLDAPAttributeMapping.php.
References $res.
Referenced by __construct().
{
$query = "SELECT * FROM ldap_attribute_mapping ".
"WHERE server_id =".$this->db->quote($this->server_id)." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->mapping_rules[$row->keyword]['value'] = $row->value;
$this->mapping_rules[$row->keyword]['performUpdate'] = (bool) $row->perform_update;
if($row->perform_update)
{
$this->rules_for_update[$row->keyword]['value'] = $row->value;
}
}
}
Here is the caller graph for this function:| ilLDAPAttributeMapping::save | ( | ) |
Save mapping rules to db.
public
Definition at line 230 of file class.ilLDAPAttributeMapping.php.
{
$this->delete();
foreach($this->mapping_rules as $keyword => $options)
{
$query = "INSERT INTO ldap_attribute_mapping SET ".
"server_id =".$this->db->quote($this->server_id).", ".
"keyword = ".$this->db->quote($keyword).", ".
"value = ".$this->db->quote($options['value']).", ".
"perform_update = ".$this->db->quote($options['performUpdate']);
$this->db->query($query);
}
}
| ilLDAPAttributeMapping::setRule | ( | $ | a_field_name, | |
| $ | a_ldap_attribute, | |||
| $ | a_perform_update | |||
| ) |
Set mapping rule.
public
| string | ILIAS user attribute | |
| string | ldap attribute | |
| bool | perform update |
Definition at line 123 of file class.ilLDAPAttributeMapping.php.
{
$this->mapping_rules[$a_field_name]['value'] = $a_ldap_attribute;
$this->mapping_rules[$a_field_name]['performUpdate'] = $a_perform_update;
}
ilLDAPAttributeMapping::$db = null [private] |
Definition at line 37 of file class.ilLDAPAttributeMapping.php.
ilLDAPAttributeMapping::$instances = array() [static, private] |
Definition at line 35 of file class.ilLDAPAttributeMapping.php.
ilLDAPAttributeMapping::$lng [private] |
Definition at line 40 of file class.ilLDAPAttributeMapping.php.
Referenced by __construct().
ilLDAPAttributeMapping::$mapping_rules = array() [private] |
Definition at line 38 of file class.ilLDAPAttributeMapping.php.
ilLDAPAttributeMapping::$rules_for_update = array() [private] |
Definition at line 39 of file class.ilLDAPAttributeMapping.php.
ilLDAPAttributeMapping::$server_id = null [private] |
Definition at line 36 of file class.ilLDAPAttributeMapping.php.
1.7.1