ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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
global $DIC
Definition: shib_login.php:26

References $DIC, $objId, $privacyIdent, $usrId, ILIAS\Repository\database(), IL_CAL_UNIX, and load().

+ Here is the call graph for this function:

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiUser::assignFromDbRow (   $dbRow)

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

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 }
const IL_CAL_DATETIME
setRegistration(string $registration)
setUsrId(int $usrId)
setObjId(int $objId)
setPrivacyIdent(int $privacyIdent)
setSatisfied(bool $satisfied)
setProxySuccess(bool $proxySuccess)
setFetchUntil(ilCmiXapiDateTime $fetchUntil)
setUsrIdent(string $usrIdent)

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

Referenced by load().

+ 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 }

Referenced by getIdent().

+ Here is the caller graph for this function:

◆ deleteUsersForObject()

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

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

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 }

References $DIC, and $objId.

Referenced by ilCmiXapiStatementsDeleteRequest\checkDeleteUsersForObject().

+ 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.

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'),
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:69

References $DIC, $objId, $privacyIdent, $res, and $usrId.

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

+ 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.

586 : \Ramsey\Uuid\UuidInterface
587 {
588 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $objId . '-' . $usrId);
589 }

References $objId, and $usrId.

Referenced by ilCmiXapiLaunchGUI\initCmixUser().

+ 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.

591 : \Ramsey\Uuid\UuidInterface
592 {
593 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $obj->getRefId() . '-' . $user->getId());
594 }

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

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

+ 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.

596 : \Ramsey\Uuid\UuidInterface
597 {
598 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getObjId() . '-' . $authToken->getUsrId());
599 }

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

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

+ 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.

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 }

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

Referenced by ilXapiResultsCronjob\getObjectsToBeReported().

+ 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.

157 {
158 return $this->fetchUntil;
159 }
ilCmiXapiDateTime $fetchUntil

References $fetchUntil.

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

+ 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.

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 }
static buildPseudoEmail(string $mbox, string $domain)
const PRIVACY_IDENT_IL_UUID_USER_ID
const PRIVACY_IDENT_IL_UUID_RANDOM
const PRIVACY_IDENT_IL_UUID_LOGIN
const PRIVACY_IDENT_REAL_EMAIL
const PRIVACY_IDENT_IL_UUID_SHA256
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
const PRIVACY_IDENT_IL_UUID_SHA256URL
static _isAnonymous(int $usr_id)
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format.
static is_email(string $a_email, ?ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

References $_SERVER, ilObjUser\_isAnonymous(), buildPseudoEmail(), 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 ilLTIConsumerContentGUI\getStartButtonTxt11(), ilCmiXapiLaunchGUI\initCmixUser(), ilLTIConsumerContentGUI\initCmixUser(), and ilLTIConsumerContentGUI\validateLTI13InitalLogin().

+ 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.

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
345
347
348 return 'realemail' . $user->getId();
349 }
350
351 return '';
352 }
static getUserObjectUniqueId(int $length=32)

References $_SERVER, ilObject\getCreateDate(), ilObjUser\getExternalAccount(), ilObject\getId(), ilObjUser\getLogin(), getUserObjectUniqueId(), 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 ilObjLTIConsumerGUI\contentSelectionRequest().

+ 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.

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 }
static getUUID(int $length=32)
ILIAS Setting Class.

References getUUID().

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

+ 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.

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 }

References $DIC, $objId, $res, and $usrIdent.

Referenced by ilXapiStatementEvaluation\getCmixUser().

+ Here is the caller graph for this function:

◆ getInstancesByObjectIdAndUsrId()

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

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

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 }

References $DIC, $objId, $res, and $usrId.

Referenced by ilCmiXapiStatementsDeleteRequest\buildDeleteOwn().

+ 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.

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 $max_strlen=0)

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().

+ 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.

71 : ?int
72 {
73 return $this->objId;
74 }

References $objId.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ getPrivacyIdent()

ilCmiXapiUser::getPrivacyIdent ( )

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

81 : ?int
82 {
84 }

References $privacyIdent.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ getRegistration()

ilCmiXapiUser::getRegistration ( )

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

111 : string
112 {
113 return $this->registration;
114 }

References $registration.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRegistrationFromAuthToken()

static ilCmiXapiUser::getRegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

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

601 : \Ramsey\Uuid\UuidInterface
602 {
603 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getRefId() . '-' . $authToken->getUsrId());
604 }

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

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

+ 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.

151 : bool
152 {
153 return $this->satisfied;
154 }

References $satisfied.

Referenced by save().

+ 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.

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 }

References $DIC, $objId, $res, and $usrId.

Referenced by ilCmiXapiStatementsReportLinkBuilder\buildFilterStage().

+ 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.

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);
554 while ($exists) {
555 $id = self::getUUID($length);//$getId($length);
557 }
558
559 return $id;
560 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static userObjectUniqueIdExists(string $id)

References $id, getUUID(), and userObjectUniqueIdExists().

Referenced by getIdentAsId().

+ Here is the call graph for this function:
+ Here is the caller 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.

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 }

References $DIC, $objId, and $res.

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

+ Here is the caller graph for this function:

◆ getUsrId()

ilCmiXapiUser::getUsrId ( )

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

91 : ?int
92 {
93 return $this->usrId;
94 }

References $usrId.

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

+ Here is the caller graph for this function:

◆ getUsrIdent()

ilCmiXapiUser::getUsrIdent ( )

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

101 : string
102 {
103 return $this->usrIdent;
104 }

References $usrIdent.

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

+ Here is the caller graph for this function:

◆ getUsrIdForObjectAndUsrIdent()

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

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

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 }

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

Referenced by ilLTIConsumerGradeServiceScores\checkScore().

+ 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.

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 }

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

Referenced by getIliasUuid(), and getUserObjectUniqueId().

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

◆ hasProxySuccess()

ilCmiXapiUser::hasProxySuccess ( )

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

133 : bool
134 {
135 return $this->proxySuccess;
136 }

References $proxySuccess.

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

+ Here is the caller graph for this function:

◆ load()

ilCmiXapiUser::load ( )
protected

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

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 }

References $res, assignFromDbRow(), ILIAS\Repository\database(), getObjId(), getPrivacyIdent(), and getUsrId().

Referenced by __construct().

+ 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.

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 }

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

+ Here is the call graph for this function:

◆ save()

ilCmiXapiUser::save ( )

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

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 }

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

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

+ 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.

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 }

References $DIC, $objId, $privacyIdent, and $usrId.

Referenced by XapiProxy\XapiProxyPolyFill\getLrsType().

+ Here is the caller graph for this function:

◆ setFetchUntil()

ilCmiXapiUser::setFetchUntil ( ilCmiXapiDateTime  $fetchUntil)

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

161 : void
162 {
163 $this->fetchUntil = $fetchUntil;
164 }

References $fetchUntil.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiUser::setObjId ( int  $objId)

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

76 : void
77 {
78 $this->objId = $objId;
79 }

References $objId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setPrivacyIdent()

ilCmiXapiUser::setPrivacyIdent ( int  $privacyIdent)

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

86 : void
87 {
88 $this->privacyIdent = $privacyIdent;
89 }

References $privacyIdent.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setProxySuccess()

ilCmiXapiUser::setProxySuccess ( bool  $proxySuccess)

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

138 : void
139 {
140 $this->proxySuccess = $proxySuccess;
141 }

References $proxySuccess.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setRegistration()

ilCmiXapiUser::setRegistration ( string  $registration)

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

116 : void
117 {
118 $this->registration = $registration;
119 }

References $registration.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setSatisfied()

ilCmiXapiUser::setSatisfied ( bool  $satisfied)

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

143 : void
144 {
145 $this->satisfied = $satisfied;
146 }

References $satisfied.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiUser::setUsrId ( int  $usrId)

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

96 : void
97 {
98 $this->usrId = $usrId;
99 }

References $usrId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrIdent()

ilCmiXapiUser::setUsrIdent ( string  $usrIdent)

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

106 : void
107 {
108 $this->usrIdent = $usrIdent;
109 }

References $usrIdent.

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

+ 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.

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

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

Referenced by ilXapiResultsCronjob\run().

+ 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.

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 }

References $DIC, and $id.

Referenced by getUserObjectUniqueId().

+ Here is the caller graph for this function:

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

◆ $privacyIdent

int ilCmiXapiUser::$privacyIdent
protected

◆ $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

◆ $usrIdent

string ilCmiXapiUser::$usrIdent
protected

◆ 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: