54        $this->server_id = $a_server_id;
 
   67        if (array_key_exists($a_server_id, self::$instances) and is_object(self::$instances[$a_server_id])) {
 
   68            return self::$instances[$a_server_id];
 
   81    public static function _delete($a_server_id)
 
   85        $query = 
"DELETE FROM ldap_attribute_mapping " .
 
   86            "WHERE server_id =" . 
$ilDB->quote($a_server_id, 
'integer');
 
  101        $query = 
"SELECT value FROM ldap_attribute_mapping " .
 
  102            "WHERE server_id =" . 
$ilDB->quote($a_server_id, 
'integer') . 
" " .
 
  103            "AND keyword = " . 
$ilDB->quote(
'global_role', 
'text');
 
  107            return (
int) 
$row->value;
 
  122        $query = 
'SELECT perform_update FROM ldap_attribute_mapping ' .
 
  123            'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
 
  124            'AND perform_update = 1';
 
  126        return $res->numRows() ? true : 
false;
 
  138    public function setRule($a_field_name, $a_ldap_attribute, $a_perform_update)
 
  140        $this->mapping_rules[$a_field_name][
'value'] = $a_ldap_attribute;
 
  141        $this->mapping_rules[$a_field_name][
'performUpdate'] = $a_perform_update;
 
  153        return $this->rules_for_update ? $this->rules_for_update : array();
 
  165        foreach ($this->rules_for_update as $field => 
$rule) {
 
  166            if (!strlen(
$rule[
'value'])) {
 
  169            if (strpos(
$rule[
'value'], 
',') === 
false) {
 
  170                $fields[] = strtolower(
$rule[
'value']);
 
  173            $tmp_fields = explode(
',', 
$rule[
'value']);
 
  175            foreach ($tmp_fields as $tmp_field) {
 
  176                $fields[] = trim(strtolower($tmp_field));
 
  179        return $fields ? $fields : array();
 
  191        foreach ($this->mapping_rules as $field => 
$rule) {
 
  192            if (!strlen(
$rule[
'value'])) {
 
  195            if (strpos(
$rule[
'value'], 
',') === 
false) {
 
  196                $fields[] = strtolower(
$rule[
'value']);
 
  199            $tmp_fields = explode(
',', 
$rule[
'value']);
 
  201            foreach ($tmp_fields as $tmp_field) {
 
  202                $fields[] = trim(strtolower($tmp_field));
 
  205        return $fields ? $fields : array();
 
  228        $this->mapping_rules = array();
 
  243        foreach ($this->mapping_rules as $keyword => 
$options) {
 
  244            $query = 
"INSERT INTO ldap_attribute_mapping (server_id,keyword,value,perform_update) " .
 
  246                $this->db->quote($this->server_id, 
'integer') . 
", " .
 
  247                $this->db->quote($keyword, 
'text') . 
", " .
 
  248                $this->db->quote(
$options[
'value'], 
'text') . 
", " .
 
  249                $this->db->quote(
$options[
'performUpdate'], 
'integer') .
 
  261    public function delete()
 
  276        if (array_key_exists($a_field_name, $this->mapping_rules)) {
 
  277            return (
bool) $this->mapping_rules[$a_field_name][
'performUpdate'];
 
  291        if (array_key_exists($a_field_name, $this->mapping_rules)) {
 
  292            return $this->mapping_rules[$a_field_name][
'value'];
 
  308        $query = 
"SELECT * FROM ldap_attribute_mapping " .
 
  309            "WHERE server_id =" . $this->db->quote($this->server_id, 
'integer') . 
" ";
 
  313            $this->mapping_rules[
$row->keyword][
'value'] = 
$row->value;
 
  314            $this->mapping_rules[
$row->keyword][
'performUpdate'] = (bool) 
$row->perform_update;
 
  316            if (
$row->perform_update) {
 
  317                $this->rules_for_update[
$row->keyword][
'value'] = 
$row->value;
 
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
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.
foreach($_POST as $key=> $value) $res