ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExternalAuthUserAttributeMapping Class Reference
+ Inheritance diagram for ilExternalAuthUserAttributeMapping:
+ Collaboration diagram for ilExternalAuthUserAttributeMapping:

Public Member Functions

 __construct (string $authMode, int $authSourceId=0)
 
 getAuthSourceId ()
 
 setAuthSourceId (int $authSourceId)
 
 getAuthMode ()
 
 setAuthMode (string $authMode)
 
 getEmptyRule ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 count ()
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 save ()
 
 delete ()
 

Protected Member Functions

 read ()
 

Protected Attributes

ilDBInterface $db
 
string $authMode
 
int $authSourceId
 
array $mapping = []
 

Detailed Description

Definition at line 21 of file class.ilExternalAuthUserAttributeMapping.php.

Constructor & Destructor Documentation

◆ __construct()

ilExternalAuthUserAttributeMapping::__construct ( string  $authMode,
int  $authSourceId = 0 
)

Member Function Documentation

◆ count()

ilExternalAuthUserAttributeMapping::count ( )

Definition at line 89 of file class.ilExternalAuthUserAttributeMapping.php.

89 : int
90 {
91 return count($this->mapping);
92 }

References count().

Referenced by count().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ current()

ilExternalAuthUserAttributeMapping::current ( )

Definition at line 94 of file class.ilExternalAuthUserAttributeMapping.php.

References current().

Referenced by current(), and valid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilExternalAuthUserAttributeMapping::delete ( )

Definition at line 156 of file class.ilExternalAuthUserAttributeMapping.php.

156 : 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 }

References getAuthMode(), and getAuthSourceId().

+ Here is the call graph for this function:

◆ getAuthMode()

ilExternalAuthUserAttributeMapping::getAuthMode ( )

Definition at line 50 of file class.ilExternalAuthUserAttributeMapping.php.

50 : string
51 {
52 return $this->authMode;
53 }

References $authMode.

Referenced by delete(), read(), and save().

+ Here is the caller graph for this function:

◆ getAuthSourceId()

ilExternalAuthUserAttributeMapping::getAuthSourceId ( )

Definition at line 40 of file class.ilExternalAuthUserAttributeMapping.php.

40 : int
41 {
43 }

References $authSourceId.

Referenced by delete(), read(), and save().

+ Here is the caller graph for this function:

◆ getEmptyRule()

ilExternalAuthUserAttributeMapping::getEmptyRule ( )

Definition at line 60 of file class.ilExternalAuthUserAttributeMapping.php.

Referenced by read().

+ Here is the caller graph for this function:

◆ key()

ilExternalAuthUserAttributeMapping::key ( )

Definition at line 104 of file class.ilExternalAuthUserAttributeMapping.php.

104 : string
105 {
106 return key($this->mapping);
107 }

References key().

Referenced by key().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ next()

ilExternalAuthUserAttributeMapping::next ( )

Definition at line 99 of file class.ilExternalAuthUserAttributeMapping.php.

99 : void
100 {
101 next($this->mapping);
102 }

References next().

Referenced by next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetExists()

ilExternalAuthUserAttributeMapping::offsetExists (   $offset)

Definition at line 65 of file class.ilExternalAuthUserAttributeMapping.php.

65 : bool
66 {
67 return isset($this->mapping[$offset]);
68 }

Referenced by offsetGet().

+ Here is the caller graph for this function:

◆ offsetGet()

ilExternalAuthUserAttributeMapping::offsetGet (   $offset)

Definition at line 70 of file class.ilExternalAuthUserAttributeMapping.php.

71 {
72 return $this->offsetExists($offset) ? $this->mapping[$offset] : null;
73 }

References offsetExists().

+ Here is the call graph for this function:

◆ offsetSet()

ilExternalAuthUserAttributeMapping::offsetSet (   $offset,
  $value 
)

Definition at line 75 of file class.ilExternalAuthUserAttributeMapping.php.

75 : void
76 {
77 if ($offset === null) {
78 $this->mapping[] = $value;
79 } else {
80 $this->mapping[$offset] = $value;
81 }
82 }

◆ offsetUnset()

ilExternalAuthUserAttributeMapping::offsetUnset (   $offset)

Definition at line 84 of file class.ilExternalAuthUserAttributeMapping.php.

84 : void
85 {
86 unset($this->mapping[$offset]);
87 }

◆ read()

ilExternalAuthUserAttributeMapping::read ( )
protected

Definition at line 119 of file class.ilExternalAuthUserAttributeMapping.php.

119 : 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 }
$res
Definition: ltiservices.php:69

References $res, getAuthMode(), getAuthSourceId(), and getEmptyRule().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

ilExternalAuthUserAttributeMapping::rewind ( )

Definition at line 114 of file class.ilExternalAuthUserAttributeMapping.php.

114 : void
115 {
116 reset($this->mapping);
117 }

◆ save()

ilExternalAuthUserAttributeMapping::save ( )

Definition at line 138 of file class.ilExternalAuthUserAttributeMapping.php.

138 : 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 }

References getAuthMode(), and getAuthSourceId().

+ Here is the call graph for this function:

◆ setAuthMode()

ilExternalAuthUserAttributeMapping::setAuthMode ( string  $authMode)

Definition at line 55 of file class.ilExternalAuthUserAttributeMapping.php.

55 : void
56 {
57 $this->authMode = $authMode;
58 }

References $authMode.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setAuthSourceId()

ilExternalAuthUserAttributeMapping::setAuthSourceId ( int  $authSourceId)

Definition at line 45 of file class.ilExternalAuthUserAttributeMapping.php.

45 : void
46 {
47 $this->authSourceId = $authSourceId;
48 }

References $authSourceId.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ valid()

ilExternalAuthUserAttributeMapping::valid ( )

Definition at line 109 of file class.ilExternalAuthUserAttributeMapping.php.

109 : bool
110 {
111 return current($this->mapping) instanceof ilExternalAuthUserAttributeMappingRule;
112 }

References current().

+ Here is the call graph for this function:

Field Documentation

◆ $authMode

string ilExternalAuthUserAttributeMapping::$authMode
protected

Definition at line 24 of file class.ilExternalAuthUserAttributeMapping.php.

Referenced by getAuthMode(), and setAuthMode().

◆ $authSourceId

int ilExternalAuthUserAttributeMapping::$authSourceId
protected

◆ $db

ilDBInterface ilExternalAuthUserAttributeMapping::$db
protected

Definition at line 23 of file class.ilExternalAuthUserAttributeMapping.php.

◆ $mapping

array ilExternalAuthUserAttributeMapping::$mapping = []
protected

Definition at line 27 of file class.ilExternalAuthUserAttributeMapping.php.


The documentation for this class was generated from the following file: