ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCmiXapiUser Class Reference
+ Collaboration diagram for ilCmiXapiUser:

Public Member Functions

 __construct (?int $objId=null, ?int $usrId=null, ?int $privacyIdent=null)
 
 getObjId ()
 
 setObjId (int $objId)
 
 getPrivacyIdent ()
 
 setPrivacyIdent (int $privacyIdent)
 
 getUsrId ()
 
 setUsrId (int $usrId)
 
 getUsrIdent ()
 
 setUsrIdent (string $usrIdent)
 
 getRegistration ()
 
 setRegistration (string $registration)
 
 hasProxySuccess ()
 
 setProxySuccess (bool $proxySuccess)
 
 setSatisfied (bool $satisfied)
 
 getSatisfied ()
 
 getFetchUntil ()
 
 setFetchUntil (ilCmiXapiDateTime $fetchUntil)
 
 assignFromDbRow ($dbRow)
 
 save ()
 

Static Public Member Functions

static getIliasUuid ()
 
static getInstancesByObjectIdAndUsrId (int $objId, int $usrId)
 
static getInstanceByObjectIdAndUsrIdent (int $objId, string $usrIdent)
 
static saveProxySuccess (int $objId, int $usrId, int $privacyIdent)
 
static getIdent (int $userIdentMode, ilObjUser $user)
 
static getIdentAsId (int $userIdentMode, ilObjUser $user)
 
static getName (int $userNameMode, ilObjUser $user)
 
static getUsersForObject (int $objId, bool $asUsrId=false)
 
static getUserIdents (int $objId, int $usrId)
 
static exists (int $objId, int $usrId, int $privacyIdent=999)
 
static getCmixObjectsHavingUsersMissingProxySuccess ()
 
static updateFetchedUntilForObjects (ilCmiXapiDateTime $fetchedUntil, array $objectIds)
 
static lookupObjectIds (int $usrId, string $type='')
 
static getUserObjectUniqueId (int $length=32)
 
static getUUID (int $length=32)
 
static generateCMI5Registration (int $objId, int $usrId)
 
static generateRegistration (ilObjCmiXapi $obj, ilObjUser $user)
 
static getCMI5RegistrationFromAuthToken (ilCmiXapiAuthToken $authToken)
 
static getRegistrationFromAuthToken (ilCmiXapiAuthToken $authToken)
 
static getUsrIdForObjectAndUsrIdent (int $objId, string $userIdent)
 
static deleteUsersForObject (int $objId, ?array $users=[])
 

Data Fields

const DB_TABLE_NAME = 'cmix_users'
 

Protected Member Functions

 load ()
 

Static Protected Member Functions

static buildPseudoEmail (string $mbox, string $domain)
 

Protected Attributes

int $objId
 
int $usrId
 
int $privacyIdent
 
bool $proxySuccess
 
bool $satisfied
 
ilCmiXapiDateTime $fetchUntil
 
string $usrIdent
 
string $registration
 

Static Private Member Functions

static userObjectUniqueIdExists (string $id)
 

Private Attributes

ilDBInterface $database
 

Detailed Description

Definition at line 30 of file class.ilCmiXapiUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilCmiXapiUser::__construct ( ?int  $objId = null,
?int  $usrId = null,
?int  $privacyIdent = null 
)

Definition at line 53 of file class.ilCmiXapiUser.php.

References $DIC, $objId, $privacyIdent, $usrId, IL_CAL_UNIX, load(), and null.

54  {
55  global $DIC;
56  $this->database = $DIC->database();
57  $this->objId = $objId;
58  $this->usrId = $usrId;
59  $this->privacyIdent = $privacyIdent;
60  $this->proxySuccess = false;
61  $this->satisfied = false;
62  $this->fetchUntil = new ilCmiXapiDateTime(0, IL_CAL_UNIX);
63  $this->usrIdent = '';
64  $this->registration = '';
65 
66  if ($objId !== null && $usrId !== null && $privacyIdent !== null) {
67  $this->load();
68  }
69  }
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiUser::assignFromDbRow (   $dbRow)

Definition at line 179 of file class.ilCmiXapiUser.php.

References IL_CAL_DATETIME, setFetchUntil(), setObjId(), setPrivacyIdent(), setProxySuccess(), setRegistration(), setSatisfied(), setUsrId(), and setUsrIdent().

Referenced by load().

179  : void
180  {
181  $this->setObjId((int) $dbRow['obj_id']);
182  $this->setUsrId((int) $dbRow['usr_id']);
183  $this->setProxySuccess((bool) $dbRow['proxy_success']);
184  $this->setSatisfied((bool) $dbRow['satisfied']);
185  $this->setFetchUntil(new ilCmiXapiDateTime($dbRow['fetched_until'], IL_CAL_DATETIME));
186  $this->setUsrIdent((string) $dbRow['usr_ident']);
187  $this->setPrivacyIdent((int) $dbRow['privacy_ident']);
188  $this->setRegistration((string) $dbRow['registration']);
189  }
setFetchUntil(ilCmiXapiDateTime $fetchUntil)
const IL_CAL_DATETIME
setSatisfied(bool $satisfied)
setUsrIdent(string $usrIdent)
setPrivacyIdent(int $privacyIdent)
setProxySuccess(bool $proxySuccess)
setUsrId(int $usrId)
setRegistration(string $registration)
setObjId(int $objId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPseudoEmail()

static ilCmiXapiUser::buildPseudoEmail ( string  $mbox,
string  $domain 
)
staticprotected

Definition at line 354 of file class.ilCmiXapiUser.php.

354  : string
355  {
356  return "{$mbox}@{$domain}.ilias";
357  }

◆ deleteUsersForObject()

static ilCmiXapiUser::deleteUsersForObject ( int  $objId,
?array  $users = [] 
)
static

Definition at line 623 of file class.ilCmiXapiUser.php.

References $DIC.

Referenced by ilCmiXapiStatementsDeleteRequest\checkDeleteUsersForObject().

623  : void
624  {
625  global $DIC; /* @var \ILIAS\DI\Container $DIC */
626  $query = "DELETE FROM cmix_users WHERE obj_id = " . $DIC->database()->quote($objId, 'integer');
627  if (count($users) == 0) {
628  $DIC->database()->manipulate($query);
629  } else {
630  $DIC->database()->manipulateF(
631  $query . " AND usr_id = %s",
632  array('integer'),
633  $users
634  );
635  }
636  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ exists()

static ilCmiXapiUser::exists ( int  $objId,
int  $usrId,
int  $privacyIdent = 999 
)
static

Definition at line 434 of file class.ilCmiXapiUser.php.

References $DIC, and $res.

Referenced by ilLPStatusCmiXapiAbstract\determineStatus(), and ilObjCmiXapiGUI\initInfoScreenToolbar().

434  : bool
435  {
436  global $DIC; /* @var \ILIAS\DI\Container $DIC */
437  if ($privacyIdent == 999) {
438  $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s";
439  $res = $DIC->database()->queryF(
440  $query,
441  array('integer', 'integer'),
442  array($objId, $usrId)
443  );
444  } else {
445  $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s";
446  $res = $DIC->database()->queryF(
447  $query,
448  array('integer', 'integer', 'integer'),
449  array($objId, $usrId, $privacyIdent)
450  );
451  }
452 
453  while ($row = $DIC->database()->fetchAssoc($res)) {
454  return (bool) $row['cnt'];
455  }
456 
457  return false;
458  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ generateCMI5Registration()

static ilCmiXapiUser::generateCMI5Registration ( int  $objId,
int  $usrId 
)
static

Definition at line 586 of file class.ilCmiXapiUser.php.

Referenced by ilCmiXapiLaunchGUI\initCmixUser().

586  : \Ramsey\Uuid\UuidInterface
587  {
588  return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $objId . '-' . $usrId);
589  }
+ Here is the caller graph for this function:

◆ generateRegistration()

static ilCmiXapiUser::generateRegistration ( ilObjCmiXapi  $obj,
ilObjUser  $user 
)
static

Definition at line 591 of file class.ilCmiXapiUser.php.

References ilObject\getId(), and ilObject\getRefId().

Referenced by ilCmiXapiLaunchGUI\CMI5preLaunch(), and ilCmiXapiLaunchGUI\getLaunchParameters().

591  : \Ramsey\Uuid\UuidInterface
592  {
593  return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $obj->getRefId() . '-' . $user->getId());
594  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCMI5RegistrationFromAuthToken()

static ilCmiXapiUser::getCMI5RegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

Definition at line 596 of file class.ilCmiXapiUser.php.

References ilCmiXapiAuthToken\getObjId(), and ilCmiXapiAuthToken\getUsrId().

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

596  : \Ramsey\Uuid\UuidInterface
597  {
598  return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getObjId() . '-' . $authToken->getUsrId());
599  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCmixObjectsHavingUsersMissingProxySuccess()

static ilCmiXapiUser::getCmixObjectsHavingUsersMissingProxySuccess ( )
static
Returns
int[]

Definition at line 463 of file class.ilCmiXapiUser.php.

References $DIC, $res, and ILIAS\Repository\int().

Referenced by ilXapiResultsCronjob\getObjectsToBeReported().

463  : array
464  {
465  global $DIC; /* @var \ILIAS\DI\Container $DIC */
466 
467  $query = "
468  SELECT DISTINCT cu.obj_id
469  FROM " . self::DB_TABLE_NAME . " cu
470  INNER JOIN object_data od
471  ON od.obj_id = cu.obj_id
472  AND od.type = 'cmix'
473  WHERE cu.proxy_success != %s
474  ";
475 
476  $res = $DIC->database()->queryF($query, array('integer'), array(1));
477 
478  $objects = array();
479 
480  while ($row = $DIC->database()->fetchAssoc($res)) {
481  $objects[] = (int) $row['obj_id'];
482  }
483 
484  return $objects;
485  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFetchUntil()

ilCmiXapiUser::getFetchUntil ( )

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

References $fetchUntil.

Referenced by ilObjCmiXapiGUI\fetchXapiStatements(), save(), and ilObjCmiXapiGUI\sendLastFetchInfo().

157  {
158  return $this->fetchUntil;
159  }
ilCmiXapiDateTime $fetchUntil
+ Here is the caller graph for this function:

◆ getIdent()

static ilCmiXapiUser::getIdent ( int  $userIdentMode,
ilObjUser  $user 
)
static

Definition at line 269 of file class.ilCmiXapiUser.php.

References $_SERVER, ilObjUser\_isAnonymous(), ilObject\getCreateDate(), ilObjUser\getEmail(), ilObjUser\getExternalAccount(), ilObject\getId(), ilObjUser\getLogin(), ilUtil\is_email(), ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_LOGIN, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_RANDOM, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256URL, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_USER_ID, and ilObjCmiXapi\PRIVACY_IDENT_REAL_EMAIL.

Referenced by ilObjLTIConsumer\buildContentSelectionParameters(), ilLTIConsumerContentGUI\getStartButtonTxt11(), ilCmiXapiLaunchGUI\initCmixUser(), ilLTIConsumerContentGUI\initCmixUser(), and ilLTIConsumerContentGUI\validateLTI13InitalLogin().

269  : string
270  {
271  if (ilObjUser::_isAnonymous($user->getId())) {
272  return self::buildPseudoEmail(hash("sha256", (string) microtime()), self::getIliasUuid());
273  }
274  switch ($userIdentMode) {
276 
277  return self::buildPseudoEmail((string) $user->getId(), self::getIliasUuid());
278 
280 
281  if (!ilUtil::is_email($user->getLogin())) {
282  return self::buildPseudoEmail($user->getLogin(), self::getIliasUuid());
283  } else {
284  return $user->getLogin();
285  }
286 
287  // no break
289 
290  return self::buildPseudoEmail($user->getExternalAccount(), self::getIliasUuid());
291 
293 
294  return self::buildPseudoEmail(hash("sha256", '' . $user->getId() . $user->getCreateDate()), self::getIliasUuid());
295 
297  $tmpHash = hash("sha256", '' . $user->getId() . $user->getCreateDate()) . '@' . str_replace('www.', '', $_SERVER['HTTP_HOST']);
298  if (strlen($tmpHash) > 80) {
299  $tmpHash = substr($tmpHash, strlen($tmpHash) - 80);
300  }
301  return $tmpHash;
302 
304 
305  return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
306 
308 
309  return $user->getEmail();
310  }
311 
312  return '';
313  }
const PRIVACY_IDENT_IL_UUID_SHA256URL
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format.
const PRIVACY_IDENT_IL_UUID_RANDOM
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
const PRIVACY_IDENT_REAL_EMAIL
static is_email(string $a_email, ?ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
const PRIVACY_IDENT_IL_UUID_SHA256
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
const PRIVACY_IDENT_IL_UUID_LOGIN
const PRIVACY_IDENT_IL_UUID_USER_ID
static _isAnonymous(int $usr_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdentAsId()

static ilCmiXapiUser::getIdentAsId ( int  $userIdentMode,
ilObjUser  $user 
)
static

Definition at line 315 of file class.ilCmiXapiUser.php.

References $_SERVER, ilObject\getCreateDate(), ilObjUser\getExternalAccount(), ilObject\getId(), ilObjUser\getLogin(), ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_LOGIN, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_RANDOM, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256URL, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_USER_ID, and ilObjCmiXapi\PRIVACY_IDENT_REAL_EMAIL.

Referenced by ilObjLTIConsumer\buildContentSelectionParameters(), ilObjLTIConsumer\buildLaunchParameters(), ilObjLTIConsumer\buildLaunchParametersLTI13(), and ilObjLTIConsumerGUI\contentSelectionRequest().

315  : string
316  {
317  switch ($userIdentMode) {
319 
320  return (string) $user->getId();
321 
323 
324  return $user->getLogin();
325 
327 
328  return $user->getExternalAccount();
329 
331 
332  return hash("sha256", '' . $user->getId() . $user->getCreateDate());
333 
335  $tmpHash = hash("sha256", '' . $user->getId() . $user->getCreateDate());
336  $tmpHost = '@' . str_replace('www.', '', $_SERVER['HTTP_HOST']);
337  if (strlen($tmpHash . $tmpHost) > 80) {
338  $tmpHash = substr($tmpHash, strlen($tmpHash) - (80 - strlen($tmpHost)));
339  }
340  return $tmpHash;
341 
343 
344  return self::getUserObjectUniqueId();
345 
347 
348  return 'realemail' . $user->getId();
349  }
350 
351  return '';
352  }
const PRIVACY_IDENT_IL_UUID_SHA256URL
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format.
const PRIVACY_IDENT_IL_UUID_RANDOM
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
const PRIVACY_IDENT_REAL_EMAIL
const PRIVACY_IDENT_IL_UUID_SHA256
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
const PRIVACY_IDENT_IL_UUID_LOGIN
const PRIVACY_IDENT_IL_UUID_USER_ID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIliasUuid()

static ilCmiXapiUser::getIliasUuid ( )
static

Definition at line 121 of file class.ilCmiXapiUser.php.

References ILIAS\ResourceStorage\Identification\getUUID(), and null.

Referenced by ilCmiXapiSettingsGUI\buildForm(), ilObjLTIConsumer\buildLaunchParameters(), ilObjCmiXapiAdministrationGUI\buildLrsTypeForm(), ilCmiXapiContentUploadImporter\generateActivityId(), ilLTIConsumeProviderFormGUI\initForm(), and ilLTIConsumeProviderFormGUI\initToolConfigForm().

121  : ?string
122  {
123  $setting = new ilSetting('cmix');
124  // Fallback
125  if (null == $setting->get('ilias_uuid', null)) {
126  // $uuid = (new \Ramsey\Uuid\UuidFactory())->uuid4()->toString();
127  $uuid = self::getUUID(32);
128  $setting->set('ilias_uuid', $uuid);
129  }
130  return $setting->get('ilias_uuid');
131  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjectIdAndUsrIdent()

static ilCmiXapiUser::getInstanceByObjectIdAndUsrIdent ( int  $objId,
string  $usrIdent 
)
static

Definition at line 235 of file class.ilCmiXapiUser.php.

References $DIC, and $res.

Referenced by ilXapiStatementEvaluation\getCmixUser().

236  {
237  global $DIC; /* @var \ILIAS\DI\Container $DIC */
238  $res = $DIC->database()->queryF(
239  "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_ident = %s",
240  array('integer', 'text'),
241  array($objId, $usrIdent)
242  );
243 
244  $cmixUser = new self();
245 
246  while ($row = $DIC->database()->fetchAssoc($res)) {
247  $cmixUser->assignFromDbRow($row);
248  }
249 
250  return $cmixUser;
251  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getInstancesByObjectIdAndUsrId()

static ilCmiXapiUser::getInstancesByObjectIdAndUsrId ( int  $objId,
int  $usrId 
)
static
Returns
[]

Definition at line 218 of file class.ilCmiXapiUser.php.

References $DIC, and $res.

Referenced by ilCmiXapiStatementsDeleteRequest\buildDeleteOwn().

218  : array
219  {
220  global $DIC; /* @var \ILIAS\DI\Container $DIC */
221  $res = $DIC->database()->queryF(
222  "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
223  array('integer', 'integer'),
224  array($objId, $usrId)
225  );
226  $cmixUsers = array();
227  while ($row = $DIC->database()->fetchAssoc($res)) {
228  $cmixUser = new self();
229  $cmixUser->assignFromDbRow($row);
230  $cmixUsers[] = $cmixUser;
231  }
232  return $cmixUsers;
233  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getName()

static ilCmiXapiUser::getName ( int  $userNameMode,
ilObjUser  $user 
)
static

Definition at line 359 of file class.ilCmiXapiUser.php.

References ilObjUser\getFirstname(), ilObjUser\getFullname(), ilObjUser\getLastname(), ilObjUser\getUTitle(), ilObjCmiXapi\PRIVACY_NAME_FIRSTNAME, ilObjCmiXapi\PRIVACY_NAME_FULLNAME, ilObjCmiXapi\PRIVACY_NAME_LASTNAME, and ilObjCmiXapi\PRIVACY_NAME_NONE.

Referenced by ilObjCmiXapi\getStatementActor().

359  : string
360  {
361  $usrName = "";
362  switch ($userNameMode) {
364  $usrName = $user->getFirstname();
365  break;
366 
368  $usrName = $user->getUTitle() ? $user->getUTitle() . ' ' : '';
369  $usrName .= $user->getLastname();
370  break;
371 
373  $usrName = $user->getFullname();
374  break;
375 
377  default:
378  $usrName = '-';
379  break;
380  }
381  return $usrName;
382  }
getFullname(int $a_max_strlen=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

ilCmiXapiUser::getObjId ( )

Definition at line 71 of file class.ilCmiXapiUser.php.

References $objId.

Referenced by load(), and save().

71  : ?int
72  {
73  return $this->objId;
74  }
+ Here is the caller graph for this function:

◆ getPrivacyIdent()

ilCmiXapiUser::getPrivacyIdent ( )

Definition at line 81 of file class.ilCmiXapiUser.php.

References $privacyIdent.

Referenced by load(), and save().

81  : ?int
82  {
83  return $this->privacyIdent;
84  }
+ Here is the caller graph for this function:

◆ getRegistration()

ilCmiXapiUser::getRegistration ( )

Definition at line 111 of file class.ilCmiXapiUser.php.

References $registration.

Referenced by save().

111  : string
112  {
113  return $this->registration;
114  }
+ Here is the caller graph for this function:

◆ getRegistrationFromAuthToken()

static ilCmiXapiUser::getRegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

Definition at line 601 of file class.ilCmiXapiUser.php.

References ilCmiXapiAuthToken\getRefId(), and ilCmiXapiAuthToken\getUsrId().

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

601  : \Ramsey\Uuid\UuidInterface
602  {
603  return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getRefId() . '-' . $authToken->getUsrId());
604  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSatisfied()

ilCmiXapiUser::getSatisfied ( )
Returns
bool $satisfied

Definition at line 151 of file class.ilCmiXapiUser.php.

References $satisfied.

Referenced by save().

151  : bool
152  {
153  return $this->satisfied;
154  }
+ Here is the caller graph for this function:

◆ getUserIdents()

static ilCmiXapiUser::getUserIdents ( int  $objId,
int  $usrId 
)
static
Returns
string[] $usrIdents

Definition at line 417 of file class.ilCmiXapiUser.php.

References $DIC, and $res.

Referenced by ilCmiXapiStatementsReportLinkBuilder\buildFilterStage().

417  : array
418  {
419  global $DIC; /* @var \ILIAS\DI\Container $DIC */
420 
421  $res = $DIC->database()->queryF(
422  "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
423  array('integer','integer'),
424  array($objId,$usrId)
425  );
426 
427  $usrIdents = [];
428  while ($row = $DIC->database()->fetchAssoc($res)) {
429  $usrIdents[] = $row['usr_ident'];
430  }
431  return $usrIdents;
432  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getUserObjectUniqueId()

static ilCmiXapiUser::getUserObjectUniqueId ( int  $length = 32)
static

Definition at line 531 of file class.ilCmiXapiUser.php.

References $id, and ILIAS\ResourceStorage\Identification\getUUID().

531  : string
532  {
533  // $storedId = self::readUserObjectUniqueId();
534  // if( (bool)strlen($storedId) ) {
535  // return strstr($storedId,'@', true);
536  // }
537 
538  // $getId = function( $length ) {
539  // $multiplier = floor($length/8) * 2;
540  // $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
541 
542  // try {
543  // $ident = bin2hex(random_bytes($length));
544  // } catch (Exception $e) {
545  // $ident = $uid;
546  // }
547 
548  // $start = rand(0, strlen($ident) - $length - 1);
549  // return substr($ident, $start, $length);
550  // };
551 
552  $id = self::getUUID($length);//$getId($length);
553  $exists = self::userObjectUniqueIdExists($id);
554  while ($exists) {
555  $id = self::getUUID($length);//$getId($length);
556  $exists = self::userObjectUniqueIdExists($id);
557  }
558 
559  return $id;
560  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getUsersForObject()

static ilCmiXapiUser::getUsersForObject ( int  $objId,
bool  $asUsrId = false 
)
static
Returns
ilCmiXapiUser[]

Definition at line 387 of file class.ilCmiXapiUser.php.

References $DIC, and $res.

Referenced by ilCmiXapiHighscoreReport\__construct(), ilCmiXapiStatementsReport\__construct(), ilCmiXapiStatementsDeleteRequest\buildDeleteAll(), ilCmiXapiStatementsDeleteRequest\buildDeleteFiltered(), ilCmiXapiStatementsDeleteRequest\buildDeleteStates(), ilCmiXapiStatementsReportLinkBuilder\buildFilterStage(), ilCmiXapiHighscoreReportLinkBuilder\getUsersStack(), ilCmiXapiStatementsGUI\initTableData(), and ilLPStatusCmiXapiAbstract\loadStatusInfo().

387  : array
388  {
389  global $DIC; /* @var \ILIAS\DI\Container $DIC */
390 
391  $res = $DIC->database()->queryF(
392  "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s",
393  array('integer'),
394  array($objId)
395  );
396 
397  $users = [];
398 
399  if ($asUsrId === false) {
400  while ($row = $DIC->database()->fetchAssoc($res)) {
401  $cmixUser = new self();
402  $cmixUser->assignFromDbRow($row);
403 
404  $users[] = $cmixUser;
405  }
406  } else {
407  while ($row = $DIC->database()->fetchAssoc($res)) {
408  $users[] = $row['usr_id'];
409  }
410  }
411  return $users;
412  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getUsrId()

ilCmiXapiUser::getUsrId ( )

Definition at line 91 of file class.ilCmiXapiUser.php.

References $usrId.

Referenced by ilCmiXapiStatementsTableGUI\getUsername(), load(), and save().

91  : ?int
92  {
93  return $this->usrId;
94  }
+ Here is the caller graph for this function:

◆ getUsrIdent()

◆ getUsrIdForObjectAndUsrIdent()

static ilCmiXapiUser::getUsrIdForObjectAndUsrIdent ( int  $objId,
string  $userIdent 
)
static

Definition at line 606 of file class.ilCmiXapiUser.php.

References $DIC, $res, $usrId, ILIAS\Repository\int(), and null.

Referenced by ilLTIConsumerGradeServiceScores\checkScore().

606  : ?int
607  {
608  global $DIC; /* @var \ILIAS\DI\Container $DIC */
609 
610  $query = "SELECT usr_id FROM " . self::DB_TABLE_NAME . " WHERE obj_id = "
611  . $DIC->database()->quote($objId, 'integer')
612  . " AND" . $DIC->database()->like('usr_ident', 'text', $userIdent . '@%');
613  $res = $DIC->database()->query($query);
614 
615  $usrId = null;
616  while ($row = $DIC->database()->fetchAssoc($res)) {
617  $usrId = (int) $row['usr_id'];
618  }
619 
620  return $usrId;
621  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUUID()

static ilCmiXapiUser::getUUID ( int  $length = 32)
static

Definition at line 562 of file class.ilCmiXapiUser.php.

References Vendor\Package\$e, and ILIAS\Repository\int().

562  : string
563  {
564  $multiplier = (int) floor($length / 8) * 2;
565  $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
566 
567  try {
568  $ident = bin2hex(random_bytes($length));
569  } catch (Exception $e) {
570  $ident = $uid;
571  }
572 
573  $start = rand(0, strlen($ident) - $length - 1);
574  return substr($ident, $start, $length);
575  }
+ Here is the call graph for this function:

◆ hasProxySuccess()

ilCmiXapiUser::hasProxySuccess ( )

Definition at line 133 of file class.ilCmiXapiUser.php.

References $proxySuccess.

Referenced by ilObjCmiXapiGUI\isFetchXapiStatementsRequired(), and save().

133  : bool
134  {
135  return $this->proxySuccess;
136  }
+ Here is the caller graph for this function:

◆ load()

ilCmiXapiUser::load ( )
protected

Definition at line 166 of file class.ilCmiXapiUser.php.

References $res, assignFromDbRow(), getObjId(), getPrivacyIdent(), and getUsrId().

Referenced by __construct().

166  : void
167  {
168  $res = $this->database->queryF(
169  "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s",
170  array('integer', 'integer', 'integer'),
171  array($this->getObjId(), $this->getUsrId(), $this->getPrivacyIdent())
172  );
173 
174  while ($row = $this->database->fetchAssoc($res)) {
175  $this->assignFromDbRow($row);
176  }
177  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupObjectIds()

static ilCmiXapiUser::lookupObjectIds ( int  $usrId,
string  $type = '' 
)
static
Returns
int[]

Definition at line 500 of file class.ilCmiXapiUser.php.

References $DIC, $res, and ILIAS\Repository\int().

500  : array
501  {
502  global $DIC; /* @var \ILIAS\DI\Container $DIC */
503 
504  $TYPE_JOIN = '';
505 
506  if (strlen($type)) {
507  $TYPE_JOIN = "
508  INNER JOIN object_data od
509  ON od.obj_id = cu.obj_id
510  AND od.type = {$DIC->database()->quote($type, 'text')}
511  ";
512  }
513 
514  $query = "
515  SELECT cu.obj_id
516  FROM " . self::DB_TABLE_NAME . " cu
517  {$TYPE_JOIN}
518  WHERE cu.usr_id = {$DIC->database()->quote($usrId, 'integer')}
519  ";
520 
521  $res = $DIC->database()->query($query);
522 
523  $objIds = [];
524 
525  while ($row = $DIC->database()->fetchAssoc($res)) {
526  $objIds[] = (int) $row['obj_id'];
527  }
528 
529  return $objIds;
530  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ save()

ilCmiXapiUser::save ( )

Definition at line 191 of file class.ilCmiXapiUser.php.

References $DIC, ilObjUser\_isAnonymous(), getFetchUntil(), getObjId(), getPrivacyIdent(), getRegistration(), getSatisfied(), getUsrId(), getUsrIdent(), hasProxySuccess(), and IL_CAL_DATETIME.

Referenced by ilLTIConsumerContentGUI\getStartButtonTxt11(), and ilLTIConsumerContentGUI\validateLTI13InitalLogin().

191  : void
192  {
193  global $DIC; /* @var \ILIAS\DI\Container $DIC */
194 
195  if (!ilObjUser::_isAnonymous($this->getUsrId())) {
196  $DIC->database()->replace(
197  self::DB_TABLE_NAME,
198  array(
199  'obj_id' => array('integer', (int) $this->getObjId()),
200  'usr_id' => array('integer', (int) $this->getUsrId()),
201  'privacy_ident' => array('integer', (int) $this->getPrivacyIdent())
202  ),
203  array(
204  'proxy_success' => array('integer', (int) $this->hasProxySuccess()),
205  'fetched_until' => array('timestamp', $this->getFetchUntil()->get(IL_CAL_DATETIME)),
206  'usr_ident' => array('text', $this->getUsrIdent()),
207  'registration' => array('text', $this->getRegistration()),
208  'satisfied' => array('integer', (int) $this->getSatisfied())
209  )
210  );
211  }
212  }
const IL_CAL_DATETIME
global $DIC
Definition: shib_login.php:22
static _isAnonymous(int $usr_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProxySuccess()

static ilCmiXapiUser::saveProxySuccess ( int  $objId,
int  $usrId,
int  $privacyIdent 
)
static

Definition at line 253 of file class.ilCmiXapiUser.php.

References $DIC.

Referenced by XapiProxy\XapiProxyPolyFill\getLrsType().

253  : void //TODO
254  {
255  global $DIC; /* @var \ILIAS\DI\Container $DIC */
256  $DIC->database()->update(
257  self::DB_TABLE_NAME,
258  array(
259  'proxy_success' => array('integer', 1)
260  ),
261  array(
262  'obj_id' => array('integer', (int) $objId),
263  'usr_id' => array('integer', (int) $usrId),
264  'privacy_ident' => array('integer', (int) $privacyIdent)
265  )
266  );
267  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setFetchUntil()

ilCmiXapiUser::setFetchUntil ( ilCmiXapiDateTime  $fetchUntil)

Definition at line 161 of file class.ilCmiXapiUser.php.

References $fetchUntil.

Referenced by assignFromDbRow().

161  : void
162  {
163  $this->fetchUntil = $fetchUntil;
164  }
ilCmiXapiDateTime $fetchUntil
+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiUser::setObjId ( int  $objId)

Definition at line 76 of file class.ilCmiXapiUser.php.

References $objId.

Referenced by assignFromDbRow().

76  : void
77  {
78  $this->objId = $objId;
79  }
+ Here is the caller graph for this function:

◆ setPrivacyIdent()

ilCmiXapiUser::setPrivacyIdent ( int  $privacyIdent)

Definition at line 86 of file class.ilCmiXapiUser.php.

References $privacyIdent.

Referenced by assignFromDbRow().

86  : void
87  {
88  $this->privacyIdent = $privacyIdent;
89  }
+ Here is the caller graph for this function:

◆ setProxySuccess()

ilCmiXapiUser::setProxySuccess ( bool  $proxySuccess)

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

References $proxySuccess.

Referenced by assignFromDbRow().

138  : void
139  {
140  $this->proxySuccess = $proxySuccess;
141  }
+ Here is the caller graph for this function:

◆ setRegistration()

ilCmiXapiUser::setRegistration ( string  $registration)

Definition at line 116 of file class.ilCmiXapiUser.php.

References $registration.

Referenced by assignFromDbRow().

116  : void
117  {
118  $this->registration = $registration;
119  }
+ Here is the caller graph for this function:

◆ setSatisfied()

ilCmiXapiUser::setSatisfied ( bool  $satisfied)

Definition at line 143 of file class.ilCmiXapiUser.php.

References $satisfied.

Referenced by assignFromDbRow().

143  : void
144  {
145  $this->satisfied = $satisfied;
146  }
+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiUser::setUsrId ( int  $usrId)

Definition at line 96 of file class.ilCmiXapiUser.php.

References $usrId.

Referenced by assignFromDbRow().

96  : void
97  {
98  $this->usrId = $usrId;
99  }
+ Here is the caller graph for this function:

◆ setUsrIdent()

ilCmiXapiUser::setUsrIdent ( string  $usrIdent)

Definition at line 106 of file class.ilCmiXapiUser.php.

References $usrIdent.

Referenced by assignFromDbRow(), ilLTIConsumerContentGUI\getStartButtonTxt11(), and ilLTIConsumerContentGUI\validateLTI13InitalLogin().

106  : void
107  {
108  $this->usrIdent = $usrIdent;
109  }
+ Here is the caller graph for this function:

◆ updateFetchedUntilForObjects()

static ilCmiXapiUser::updateFetchedUntilForObjects ( ilCmiXapiDateTime  $fetchedUntil,
array  $objectIds 
)
static

Definition at line 487 of file class.ilCmiXapiUser.php.

References $DIC, ilDateTime\get(), and IL_CAL_DATETIME.

Referenced by ilXapiResultsCronjob\run().

487  : void
488  {
489  global $DIC; /* @var \ILIAS\DI\Container $DIC */
490 
491  $IN_objIds = $DIC->database()->in('obj_id', $objectIds, false, 'integer');
492 
493  $query = "UPDATE " . self::DB_TABLE_NAME . " SET fetched_until = %s WHERE $IN_objIds";
494  $DIC->database()->manipulateF($query, array('timestamp'), array($fetchedUntil->get(IL_CAL_DATETIME)));
495  }
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
const IL_CAL_DATETIME
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userObjectUniqueIdExists()

static ilCmiXapiUser::userObjectUniqueIdExists ( string  $id)
staticprivate

Definition at line 577 of file class.ilCmiXapiUser.php.

References $DIC.

577  : bool
578  {
579  global $DIC; /* @var \ILIAS\DI\Container $DIC */
580 
581  $query = "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE " . $DIC->database()->like('usr_ident', 'text', $id . '@%');
582  $result = $DIC->database()->query($query);
583  return $result->numRows() != 0;
584  }
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

Field Documentation

◆ $database

ilDBInterface ilCmiXapiUser::$database
private

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

◆ $fetchUntil

ilCmiXapiDateTime ilCmiXapiUser::$fetchUntil
protected

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

Referenced by getFetchUntil(), and setFetchUntil().

◆ $objId

int ilCmiXapiUser::$objId
protected

Definition at line 34 of file class.ilCmiXapiUser.php.

Referenced by __construct(), getObjId(), and setObjId().

◆ $privacyIdent

int ilCmiXapiUser::$privacyIdent
protected

Definition at line 38 of file class.ilCmiXapiUser.php.

Referenced by __construct(), getPrivacyIdent(), and setPrivacyIdent().

◆ $proxySuccess

bool ilCmiXapiUser::$proxySuccess
protected

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

Referenced by hasProxySuccess(), and setProxySuccess().

◆ $registration

string ilCmiXapiUser::$registration
protected

Definition at line 48 of file class.ilCmiXapiUser.php.

Referenced by getRegistration(), and setRegistration().

◆ $satisfied

bool ilCmiXapiUser::$satisfied
protected

Definition at line 42 of file class.ilCmiXapiUser.php.

Referenced by getSatisfied(), and setSatisfied().

◆ $usrId

int ilCmiXapiUser::$usrId
protected

◆ $usrIdent

string ilCmiXapiUser::$usrIdent
protected

Definition at line 46 of file class.ilCmiXapiUser.php.

Referenced by getUsrIdent(), and setUsrIdent().

◆ DB_TABLE_NAME

const ilCmiXapiUser::DB_TABLE_NAME = 'cmix_users'

Definition at line 32 of file class.ilCmiXapiUser.php.


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