19 declare(strict_types=1);
33 public function __construct(
string $authMode,
int $authSourceId = 0)
36 $this->db = $DIC->database();
71 return isset($this->mapping[$offset]);
76 return $this->
offsetExists($offset) ? $this->mapping[$offset] : null;
81 if (is_null($offset)) {
82 $this->mapping[] = $value;
84 $this->mapping[$offset] = $value;
90 unset($this->mapping[$offset]);
95 return count($this->mapping);
100 return current($this->mapping);
105 next($this->mapping);
110 return key($this->mapping);
115 return current($this->mapping);
120 reset($this->mapping);
123 protected function read(): void
127 $res = $this->db->queryF(
128 'SELECT * FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s',
132 while ($row = $this->db->fetchAssoc(
$res)) {
134 $rule->setAttribute($row[
'attribute']);
135 $rule->setExternalAttribute($row[
'ext_attribute']);
136 $rule->updateAutomatically((
bool) $row[
'update_automatically']);
138 $this->mapping[$rule->getAttribute()] = $rule;
144 foreach ($this->mapping as $rule) {
146 'auth_ext_attr_mapping',
150 'attribute' => [
'text', $rule->getAttribute()]
153 'ext_attribute' => [
'text', $rule->getExternalAttribute()],
154 'update_automatically' => [
'integer', (
int) $rule->isAutomaticallyUpdated()]
160 public function delete():
void 163 $this->db->manipulateF(
164 'DELETE FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s',
offsetSet($offset, $value)
__construct(string $authMode, int $authSourceId=0)
Class ilExternalAuthUserAttributeMapping.
Class ilExternalAuthUserAttributeMappingRule.
setAuthSourceId(int $authSourceId)
setAuthMode(string $authMode)