ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilExternalAuthUserAttributeMapping.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
require_once
'Services/Authentication/classes/External/UserAttributeMapping/class.ilExternalAuthUserAttributeMappingRule.php'
;
5
10
class
ilExternalAuthUserAttributeMapping
implements
ArrayAccess
,
Countable
,
Iterator
11
{
15
protected
$db
;
16
20
protected
$authMode
=
''
;
21
25
protected
$authSourceId
;
26
30
protected
$mapping
=
array
();
31
37
public
function
__construct
(
$authMode
,
$authSourceId
= 0)
38
{
39
assert(is_string(
$authMode
));
40
assert(is_numeric(
$authSourceId
));
41
42
$this->db =
$GLOBALS
[
'DIC'
]->database();
43
44
$this->
setAuthMode
(
$authMode
);
45
$this->
setAuthSourceId
(
$authSourceId
);
46
47
$this->
read
();
48
}
49
53
public
function
getAuthSourceId
()
54
{
55
return
$this->authSourceId
;
56
}
57
61
public
function
setAuthSourceId
(
$authSourceId
)
62
{
63
$this->authSourceId =
$authSourceId
;
64
}
65
69
public
function
getAuthMode
()
70
{
71
return
$this->authMode
;
72
}
73
77
public
function
setAuthMode
(
$authMode
)
78
{
79
$this->authMode =
$authMode
;
80
}
81
85
public
function
getEmptyRule
()
86
{
87
return
new
ilExternalAuthUserAttributeMappingRule
();
88
}
89
93
public
function
offsetExists
($offset)
94
{
95
return
isset($this->mapping[$offset]);
96
}
97
101
public
function
offsetGet
($offset)
102
{
103
return
$this->
offsetExists
($offset) ? $this->mapping[$offset] : null;
104
}
105
109
public
function
offsetSet
($offset, $value)
110
{
111
if
(is_null($offset)) {
112
$this->mapping[] = $value;
113
}
else
{
114
$this->mapping[$offset] = $value;
115
}
116
}
117
121
public
function
offsetUnset
($offset)
122
{
123
unset($this->mapping[$offset]);
124
}
125
129
public
function
count
()
130
{
131
return
count
($this->mapping);
132
}
133
137
public
function
current
()
138
{
139
return
current
($this->mapping);
140
}
141
145
public
function
next
()
146
{
147
next
($this->mapping);
148
}
149
153
public
function
key
()
154
{
155
return
key
($this->mapping);
156
}
157
161
public
function
valid
()
162
{
163
return
current
($this->mapping);
164
}
165
166
public
function
rewind
()
167
{
168
reset($this->mapping);
169
}
170
174
protected
function
read
()
175
{
176
$this->mapping =
array
();
177
178
$res
= $this->db->queryF(
179
'SELECT * FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s'
,
180
array
(
'text'
,
'integer'
),
181
array
($this->
getAuthMode
(), $this->
getAuthSourceId
())
182
);
183
while
(
$row
= $this->db->fetchAssoc(
$res
)) {
184
$rule
= $this->
getEmptyRule
();
185
$rule
->setAttribute(
$row
[
'attribute'
]);
186
$rule
->setExternalAttribute(
$row
[
'ext_attribute'
]);
187
$rule
->updateAutomatically((
bool
)
$row
[
'update_automatically'
]);
188
189
$this->mapping[
$rule
->getAttribute()] =
$rule
;
190
}
191
}
192
196
public
function
save
()
197
{
198
foreach
($this->mapping as
$rule
) {
199
$this->db->replace(
200
'auth_ext_attr_mapping'
,
201
array
(
202
'auth_mode'
=>
array
(
'text'
, $this->
getAuthMode
()),
203
'auth_src_id'
=>
array
(
'integer'
, $this->
getAuthSourceId
()),
204
'attribute'
=>
array
(
'text'
, $rule->getAttribute())
205
),
206
array
(
207
'ext_attribute'
=>
array
(
'text'
, $rule->getExternalAttribute()),
208
'update_automatically'
=>
array
(
'integer'
, (
int
) $rule->isAutomaticallyUpdated())
209
)
210
);
211
}
212
}
213
217
public
function
delete
()
218
{
219
$this->mapping =
array
();
220
$this->db->manipulateF(
221
'DELETE FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s'
,
222
array
(
'text'
,
'integer'
),
223
array
($this->
getAuthMode
(), $this->
getAuthSourceId
())
224
);
225
}
226
}
ilExternalAuthUserAttributeMapping\offsetUnset
offsetUnset($offset)
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:121
ilExternalAuthUserAttributeMapping\$mapping
$mapping
Definition:
class.ilExternalAuthUserAttributeMapping.php:30
ilExternalAuthUserAttributeMapping\offsetSet
offsetSet($offset, $value)
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:109
ilExternalAuthUserAttributeMapping\$authMode
$authMode
Definition:
class.ilExternalAuthUserAttributeMapping.php:20
ilExternalAuthUserAttributeMapping\next
next()
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:145
ilExternalAuthUserAttributeMapping\$db
$db
Definition:
class.ilExternalAuthUserAttributeMapping.php:15
$GLOBALS
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Definition:
generate-standalone.php:18
ilExternalAuthUserAttributeMapping\count
count()
Definition:
class.ilExternalAuthUserAttributeMapping.php:129
ilExternalAuthUserAttributeMapping\current
current()
Definition:
class.ilExternalAuthUserAttributeMapping.php:137
ilExternalAuthUserAttributeMapping\getAuthSourceId
getAuthSourceId()
Definition:
class.ilExternalAuthUserAttributeMapping.php:53
ilExternalAuthUserAttributeMapping\offsetExists
offsetExists($offset)
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:93
ilExternalAuthUserAttributeMapping\getAuthMode
getAuthMode()
Definition:
class.ilExternalAuthUserAttributeMapping.php:69
ilExternalAuthUserAttributeMapping
Class ilExternalAuthUserAttributeMapping.
Definition:
class.ilExternalAuthUserAttributeMapping.php:10
ilExternalAuthUserAttributeMapping\setAuthSourceId
setAuthSourceId($authSourceId)
Definition:
class.ilExternalAuthUserAttributeMapping.php:61
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$rule
$rule
Definition:
showstats.php:43
ilExternalAuthUserAttributeMappingRule
Class ilExternalAuthUserAttributeMappingRule.
Definition:
class.ilExternalAuthUserAttributeMappingRule.php:8
ilExternalAuthUserAttributeMapping\save
save()
Definition:
class.ilExternalAuthUserAttributeMapping.php:196
ilExternalAuthUserAttributeMapping\key
key()
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:153
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilExternalAuthUserAttributeMapping\valid
valid()
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:161
Iterator
ArrayAccess
ilExternalAuthUserAttributeMapping\offsetGet
offsetGet($offset)
{}
Definition:
class.ilExternalAuthUserAttributeMapping.php:101
ilExternalAuthUserAttributeMapping\rewind
rewind()
Definition:
class.ilExternalAuthUserAttributeMapping.php:166
Countable
ilExternalAuthUserAttributeMapping\$authSourceId
$authSourceId
Definition:
class.ilExternalAuthUserAttributeMapping.php:25
$row
$row
Definition:
10autofilter-selection-1.php:74
ilExternalAuthUserAttributeMapping\getEmptyRule
getEmptyRule()
Definition:
class.ilExternalAuthUserAttributeMapping.php:85
ilExternalAuthUserAttributeMapping\read
read()
Definition:
class.ilExternalAuthUserAttributeMapping.php:174
ilExternalAuthUserAttributeMapping\setAuthMode
setAuthMode($authMode)
Definition:
class.ilExternalAuthUserAttributeMapping.php:77
ilExternalAuthUserAttributeMapping\__construct
__construct($authMode, $authSourceId=0)
ilExternalAuthUserAttributeMapping constructor.
Definition:
class.ilExternalAuthUserAttributeMapping.php:37
Services
Authentication
classes
External
UserAttributeMapping
class.ilExternalAuthUserAttributeMapping.php
Generated on Tue Jan 28 2025 19:01:29 for ILIAS by
1.8.13 (using
Doxyfile
)