ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExternalAuthUserAttributeMapping Class Reference

Class ilExternalAuthUserAttributeMapping. More...

+ 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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ count()

ilExternalAuthUserAttributeMapping::count ( )

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

93  : int
94  {
95  return count($this->mapping);
96  }

◆ current()

ilExternalAuthUserAttributeMapping::current ( )

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

Referenced by valid().

+ Here is the caller graph for this function:

◆ delete()

ilExternalAuthUserAttributeMapping::delete ( )

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

References getAuthMode(), and getAuthSourceId().

160  : void
161  {
162  $this->mapping = [];
163  $this->db->manipulateF(
164  'DELETE FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s',
165  ['text', 'integer'],
166  [$this->getAuthMode(), $this->getAuthSourceId()]
167  );
168  }
+ Here is the call graph for this function:

◆ getAuthMode()

ilExternalAuthUserAttributeMapping::getAuthMode ( )

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

References $authMode.

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

54  : string
55  {
56  return $this->authMode;
57  }
+ Here is the caller graph for this function:

◆ getAuthSourceId()

ilExternalAuthUserAttributeMapping::getAuthSourceId ( )

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

References $authSourceId.

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

+ Here is the caller graph for this function:

◆ getEmptyRule()

ilExternalAuthUserAttributeMapping::getEmptyRule ( )

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

Referenced by read().

+ Here is the caller graph for this function:

◆ key()

ilExternalAuthUserAttributeMapping::key ( )

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

109  {
110  return key($this->mapping);
111  }

◆ next()

ilExternalAuthUserAttributeMapping::next ( )

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

103  : void
104  {
105  next($this->mapping);
106  }

◆ offsetExists()

ilExternalAuthUserAttributeMapping::offsetExists (   $offset)

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

Referenced by offsetGet().

69  : bool
70  {
71  return isset($this->mapping[$offset]);
72  }
+ Here is the caller graph for this function:

◆ offsetGet()

ilExternalAuthUserAttributeMapping::offsetGet (   $offset)

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

References offsetExists().

75  {
76  return $this->offsetExists($offset) ? $this->mapping[$offset] : null;
77  }
+ Here is the call graph for this function:

◆ offsetSet()

ilExternalAuthUserAttributeMapping::offsetSet (   $offset,
  $value 
)

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

79  : void
80  {
81  if (is_null($offset)) {
82  $this->mapping[] = $value;
83  } else {
84  $this->mapping[$offset] = $value;
85  }
86  }

◆ offsetUnset()

ilExternalAuthUserAttributeMapping::offsetUnset (   $offset)

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

88  : void
89  {
90  unset($this->mapping[$offset]);
91  }

◆ read()

ilExternalAuthUserAttributeMapping::read ( )
protected

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

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

Referenced by __construct().

123  : void
124  {
125  $this->mapping = [];
126 
127  $res = $this->db->queryF(
128  'SELECT * FROM auth_ext_attr_mapping WHERE auth_mode = %s AND auth_src_id = %s',
129  ['text', 'integer'],
130  [$this->getAuthMode(), $this->getAuthSourceId()]
131  );
132  while ($row = $this->db->fetchAssoc($res)) {
133  $rule = $this->getEmptyRule();
134  $rule->setAttribute($row['attribute']);
135  $rule->setExternalAttribute($row['ext_attribute']);
136  $rule->updateAutomatically((bool) $row['update_automatically']);
137 
138  $this->mapping[$rule->getAttribute()] = $rule;
139  }
140  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

ilExternalAuthUserAttributeMapping::rewind ( )

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

118  : void
119  {
120  reset($this->mapping);
121  }

◆ save()

ilExternalAuthUserAttributeMapping::save ( )

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

References getAuthMode(), getAuthSourceId(), and ILIAS\Repository\int().

142  : void
143  {
144  foreach ($this->mapping as $rule) {
145  $this->db->replace(
146  'auth_ext_attr_mapping',
147  [
148  'auth_mode' => ['text', $this->getAuthMode()],
149  'auth_src_id' => ['integer', $this->getAuthSourceId()],
150  'attribute' => ['text', $rule->getAttribute()]
151  ],
152  [
153  'ext_attribute' => ['text', $rule->getExternalAttribute()],
154  'update_automatically' => ['integer', (int) $rule->isAutomaticallyUpdated()]
155  ]
156  );
157  }
158  }
+ Here is the call graph for this function:

◆ setAuthMode()

ilExternalAuthUserAttributeMapping::setAuthMode ( string  $authMode)

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

References $authMode.

Referenced by __construct().

59  : void
60  {
61  $this->authMode = $authMode;
62  }
+ Here is the caller graph for this function:

◆ setAuthSourceId()

ilExternalAuthUserAttributeMapping::setAuthSourceId ( int  $authSourceId)

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

References $authSourceId.

Referenced by __construct().

49  : void
50  {
51  $this->authSourceId = $authSourceId;
52  }
+ Here is the caller graph for this function:

◆ valid()

ilExternalAuthUserAttributeMapping::valid ( )

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

References current().

114  {
115  return current($this->mapping);
116  }
+ Here is the call graph for this function:

Field Documentation

◆ $authMode

string ilExternalAuthUserAttributeMapping::$authMode
protected

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

Referenced by getAuthMode(), and setAuthMode().

◆ $authSourceId

int ilExternalAuthUserAttributeMapping::$authSourceId
protected

◆ $db

ilDBInterface ilExternalAuthUserAttributeMapping::$db
protected

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

◆ $mapping

array ilExternalAuthUserAttributeMapping::$mapping = []
protected

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


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