ILIAS
trunk Revision v13.0_alpha-52-g21c366bbdd4
◀ ilDoc Overview
class.ilExternalAuthUserAttributeMapping.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
class
ilExternalAuthUserAttributeMapping
implements
ArrayAccess, Countable, Iterator
22
{
23
protected
ilDBInterface
$db
;
24
protected
string
$authMode
;
25
protected
int
$authSourceId
;
27
protected
array
$mapping
= [];
28
29
public
function
__construct
(
string
$authMode
,
int
$authSourceId
= 0)
30
{
31
global
$DIC
;
32
$this->db =
$DIC
->database();
33
34
$this->
setAuthMode
($authMode);
35
$this->
setAuthSourceId
($authSourceId);
36
37
$this->
read
();
38
}
39
40
public
function
getAuthSourceId
():
int
41
{
42
return
$this->authSourceId
;
43
}
44
45
public
function
setAuthSourceId
(
int
$authSourceId): void
46
{
47
$this->authSourceId =
$authSourceId
;
48
}
49
50
public
function
getAuthMode
(): string
51
{
52
return
$this->authMode
;
53
}
54
55
public
function
setAuthMode
(
string
$authMode
): void
56
{
57
$this->authMode =
$authMode
;
58
}
59
60
public
function
getEmptyRule
():
ilExternalAuthUserAttributeMappingRule
61
{
62
return
new
ilExternalAuthUserAttributeMappingRule
();
63
}
64
65
public
function
offsetExists
($offset): bool
66
{
67
return
isset($this->mapping[$offset]);
68
}
69
70
public
function
offsetGet
($offset): ?
ilExternalAuthUserAttributeMappingRule
71
{
72
return
$this->
offsetExists
($offset) ? $this->mapping[$offset] :
null
;
73
}
74
75
public
function
offsetSet
($offset, $value): void
76
{
77
if
($offset ===
null
) {
78
$this->mapping[] = $value;
79
}
else
{
80
$this->mapping[$offset] = $value;
81
}
82
}
83
84
public
function
offsetUnset
($offset): void
85
{
86
unset($this->mapping[$offset]);
87
}
88
89
public
function
count
():
int
90
{
91
return
count
($this->mapping);
92
}
93
94
public
function
current
():
ilExternalAuthUserAttributeMappingRule
95
{
96
return
current
($this->mapping);
97
}
98
99
public
function
next
(): void
100
{
101
next
($this->mapping);
102
}
103
104
public
function
key
(): string
105
{
106
return
key
($this->mapping);
107
}
108
109
public
function
valid
(): bool
110
{
111
return
current
($this->mapping) instanceof
ilExternalAuthUserAttributeMappingRule
;
112
}
113
114
public
function
rewind
(): void
115
{
116
reset($this->mapping);
117
}
118
119
protected
function
read
(): void
120
{
121
$this->mapping = [];
122
123
$res
= $this->db->queryF(
124
'SELECT * FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s'
,
125
[
'text'
,
'integer'
],
126
[$this->
getAuthMode
(), $this->
getAuthSourceId
()]
127
);
128
while
($row = $this->db->fetchAssoc(
$res
)) {
129
$rule = $this->
getEmptyRule
();
130
$rule->setAttribute($row[
'attribute'
]);
131
$rule->setExternalAttribute($row[
'ext_attribute'
]);
132
$rule->updateAutomatically((
bool
) $row[
'update_automatically'
]);
133
134
$this->mapping[$rule->getAttribute()] = $rule;
135
}
136
}
137
138
public
function
save
(): void
139
{
140
foreach
($this->mapping as $rule) {
141
$this->db->replace(
142
'auth_ext_attr_mapping'
,
143
[
144
'auth_mode'
=> [
'text'
, $this->
getAuthMode
()],
145
'auth_src_id'
=> [
'integer'
, $this->
getAuthSourceId
()],
146
'attribute'
=> [
'text'
, $rule->getAttribute()]
147
],
148
[
149
'ext_attribute'
=> [
'text'
, $rule->getExternalAttribute()],
150
'update_automatically'
=> [
'integer'
, (
int
) $rule->isAutomaticallyUpdated()]
151
]
152
);
153
}
154
}
155
156
public
function
delete
():
void
157
{
158
$this->mapping = [];
159
$this->db->manipulateF(
160
'DELETE FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s'
,
161
[
'text'
,
'integer'
],
162
[$this->
getAuthMode
(), $this->
getAuthSourceId
()]
163
);
164
}
165
}
ilExternalAuthUserAttributeMappingRule
Definition:
class.ilExternalAuthUserAttributeMappingRule.php:22
ilExternalAuthUserAttributeMapping
Definition:
class.ilExternalAuthUserAttributeMapping.php:22
ilExternalAuthUserAttributeMapping\$db
ilDBInterface $db
Definition:
class.ilExternalAuthUserAttributeMapping.php:23
ilExternalAuthUserAttributeMapping\save
save()
Definition:
class.ilExternalAuthUserAttributeMapping.php:138
ilExternalAuthUserAttributeMapping\setAuthMode
setAuthMode(string $authMode)
Definition:
class.ilExternalAuthUserAttributeMapping.php:55
ilExternalAuthUserAttributeMapping\$authSourceId
int $authSourceId
Definition:
class.ilExternalAuthUserAttributeMapping.php:25
ilExternalAuthUserAttributeMapping\getAuthSourceId
getAuthSourceId()
Definition:
class.ilExternalAuthUserAttributeMapping.php:40
ilExternalAuthUserAttributeMapping\$mapping
array $mapping
Definition:
class.ilExternalAuthUserAttributeMapping.php:27
ilExternalAuthUserAttributeMapping\getAuthMode
getAuthMode()
Definition:
class.ilExternalAuthUserAttributeMapping.php:50
ilExternalAuthUserAttributeMapping\setAuthSourceId
setAuthSourceId(int $authSourceId)
Definition:
class.ilExternalAuthUserAttributeMapping.php:45
ilExternalAuthUserAttributeMapping\valid
valid()
Definition:
class.ilExternalAuthUserAttributeMapping.php:109
ilExternalAuthUserAttributeMapping\offsetGet
offsetGet($offset)
Definition:
class.ilExternalAuthUserAttributeMapping.php:70
ilExternalAuthUserAttributeMapping\count
count()
Definition:
class.ilExternalAuthUserAttributeMapping.php:89
ilExternalAuthUserAttributeMapping\getEmptyRule
getEmptyRule()
Definition:
class.ilExternalAuthUserAttributeMapping.php:60
ilExternalAuthUserAttributeMapping\offsetUnset
offsetUnset($offset)
Definition:
class.ilExternalAuthUserAttributeMapping.php:84
ilExternalAuthUserAttributeMapping\__construct
__construct(string $authMode, int $authSourceId=0)
Definition:
class.ilExternalAuthUserAttributeMapping.php:29
ilExternalAuthUserAttributeMapping\offsetSet
offsetSet($offset, $value)
Definition:
class.ilExternalAuthUserAttributeMapping.php:75
ilExternalAuthUserAttributeMapping\key
key()
Definition:
class.ilExternalAuthUserAttributeMapping.php:104
ilExternalAuthUserAttributeMapping\offsetExists
offsetExists($offset)
Definition:
class.ilExternalAuthUserAttributeMapping.php:65
ilExternalAuthUserAttributeMapping\next
next()
Definition:
class.ilExternalAuthUserAttributeMapping.php:99
ilExternalAuthUserAttributeMapping\read
read()
Definition:
class.ilExternalAuthUserAttributeMapping.php:119
ilExternalAuthUserAttributeMapping\current
current()
Definition:
class.ilExternalAuthUserAttributeMapping.php:94
ilExternalAuthUserAttributeMapping\$authMode
string $authMode
Definition:
class.ilExternalAuthUserAttributeMapping.php:24
ilExternalAuthUserAttributeMapping\rewind
rewind()
Definition:
class.ilExternalAuthUserAttributeMapping.php:114
ilDBInterface
Interface ilDBInterface.
Definition:
ilDBInterface.php:30
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:30
$DIC
global $DIC
Definition:
shib_login.php:26
components
ILIAS
Authentication
classes
External
UserAttributeMapping
class.ilExternalAuthUserAttributeMapping.php
Generated on Tue Nov 10 2026 23:07:19 for ILIAS by
1.9.4 (using
Doxyfile
)