ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 33 of file class.ilCmiXapiUser.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

57 {
58 global $DIC;
59 $this->database = $DIC->database();
60 $this->objId = $objId;
61 $this->usrId = $usrId;
62 $this->privacyIdent = $privacyIdent;
63 $this->proxySuccess = false;
64 $this->satisfied = false;
65 $this->fetchUntil = new ilCmiXapiDateTime(0, IL_CAL_UNIX);
66 $this->usrIdent = '';
67 $this->registration = '';
68
69 if ($objId !== null && $usrId !== null && $privacyIdent !== null) {
70 $this->load();
71 }
72 }
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 181 of file class.ilCmiXapiUser.php.

181 : void
182 {
183 $this->setObjId((int) $dbRow['obj_id']);
184 $this->setUsrId((int) $dbRow['usr_id']);
185 $this->setProxySuccess((bool) $dbRow['proxy_success']);
186 $this->setSatisfied((bool) $dbRow['satisfied']);
187 $this->setFetchUntil(new ilCmiXapiDateTime($dbRow['fetched_until'], IL_CAL_DATETIME));
188 $this->setUsrIdent((string) $dbRow['usr_ident']);
189 $this->setPrivacyIdent((int) $dbRow['privacy_ident']);
190 $this->setRegistration((string) $dbRow['registration']);
191 }
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 356 of file class.ilCmiXapiUser.php.

356 : string
357 {
358 return "{$mbox}@{$domain}.ilias";
359 }

Referenced by getIdent().

+ Here is the caller graph for this function:

◆ deleteUsersForObject()

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

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

625 : void
626 {
627 global $DIC; /* @var \ILIAS\DI\Container $DIC */
628 $query = "DELETE FROM cmix_users WHERE obj_id = " . $DIC->database()->quote($objId, 'integer');
629 if (count($users) == 0) {
630 $DIC->database()->manipulate($query);
631 } else {
632 $DIC->database()->manipulateF(
633 $query . " AND usr_id = %s",
634 array('integer'),
635 $users
636 );
637 }
638 }

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 436 of file class.ilCmiXapiUser.php.

436 : bool
437 {
438 global $DIC; /* @var \ILIAS\DI\Container $DIC */
439 if ($privacyIdent == 999) {
440 $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s";
441 $res = $DIC->database()->queryF(
442 $query,
443 array('integer', 'integer'),
444 array($objId, $usrId)
445 );
446 } else {
447 $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s";
448 $res = $DIC->database()->queryF(
449 $query,
450 array('integer', 'integer', 'integer'),
452 );
453 }
454
455 while ($row = $DIC->database()->fetchAssoc($res)) {
456 return (bool) $row['cnt'];
457 }
458
459 return false;
460 }
foreach($_POST as $key=> $value) $res

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 588 of file class.ilCmiXapiUser.php.

588 : Uuid
589 {
590 return (new UuidFactory())->uuid3(self::getIliasUuid(), $objId . '-' . $usrId);
591 }

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 593 of file class.ilCmiXapiUser.php.

593 : Uuid
594 {
595 return (new UuidFactory())->uuid3(self::getIliasUuid(), $obj->getRefId() . '-' . $user->getId());
596 }

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 598 of file class.ilCmiXapiUser.php.

598 : Uuid
599 {
600 return (new UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getObjId() . '-' . $authToken->getUsrId());
601 }

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 465 of file class.ilCmiXapiUser.php.

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

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 158 of file class.ilCmiXapiUser.php.

159 {
160 return $this->fetchUntil;
161 }
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 271 of file class.ilCmiXapiUser.php.

271 : string
272 {
273 if (ilObjUser::_isAnonymous($user->getId())) {
274 return self::buildPseudoEmail(hash("sha256", (string) microtime()), self::getIliasUuid());
275 }
276 switch ($userIdentMode) {
278
279 return self::buildPseudoEmail((string) $user->getId(), self::getIliasUuid());
280
282
283 if (!ilUtil::is_email($user->getLogin())) {
284 return self::buildPseudoEmail($user->getLogin(), self::getIliasUuid());
285 } else {
286 return $user->getLogin();
287 }
288
289 // no break
291
292 return self::buildPseudoEmail($user->getExternalAccount(), self::getIliasUuid());
293
295
296 return self::buildPseudoEmail(hash("sha256", '' . $user->getId() . $user->getCreateDate()), self::getIliasUuid());
297
299 $tmpHash = hash("sha256", '' . $user->getId() . $user->getCreateDate()) . '@' . str_replace('www.', '', $_SERVER['HTTP_HOST']);
300 if (strlen($tmpHash) > 80) {
301 $tmpHash = substr($tmpHash, strlen($tmpHash) - 80);
302 }
303 return $tmpHash;
304
306
307 return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
308
310
311 return $user->getEmail();
312 }
313
314 return '';
315 }
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.

References 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 ilLTIToolLaunchGUI\getCmixUser(), ilLTIAdvantagePlatformMembershipService\getMember(), ilCmiXapiLaunchGUI\initCmixUser(), and ilLTIAdvantagePlatformDeepLinking\sendRequestPage().

+ 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 317 of file class.ilCmiXapiUser.php.

317 : string
318 {
319 switch ($userIdentMode) {
321
322 return (string) $user->getId();
323
325
326 return $user->getLogin();
327
329
330 return $user->getExternalAccount();
331
333
334 return hash("sha256", '' . $user->getId() . $user->getCreateDate());
335
337 $tmpHash = hash("sha256", '' . $user->getId() . $user->getCreateDate());
338 $tmpHost = '@' . str_replace('www.', '', $_SERVER['HTTP_HOST']);
339 if (strlen($tmpHash . $tmpHost) > 80) {
340 $tmpHash = substr($tmpHash, strlen($tmpHash) - (80 - strlen($tmpHost)));
341 }
342 return $tmpHash;
343
345
347
349
350 return 'realemail' . $user->getId();
351 }
352
353 return '';
354 }
static getUserObjectUniqueId(int $length=32)

References 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 ilLTIAdvantagePlatformLaunchParameterBuilder\getUserId(), and ilLTIAdvantagePlatformDeepLinking\sendRequestPage().

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

◆ getIliasUuid()

static ilCmiXapiUser::getIliasUuid ( )
static

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

124 : ?string
125 {
126 $setting = new ilSetting('cmix');
127 // Fallback
128 if (null == $setting->get('ilias_uuid', null)) {
129 $uuid = self::getUUID(32);
130 $setting->set('ilias_uuid', $uuid);
131 }
132 return $setting->get('ilias_uuid');
133 }
static getUUID(int $length=32)
ILIAS Setting Class.

References ILIAS\components\ResourceStorage\$uuid, and getUUID().

Referenced by ilCmiXapiSettingsGUI\buildForm(), ilObjCmiXapiAdministrationGUI\buildLrsTypeForm(), ilCmiXapiContentUploadImporter\generateActivityId(), ilLTIToolForm\getForm(), and ilLTIAdvantagePlatformLaunchParameterBuilder\getUserId().

+ 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 237 of file class.ilCmiXapiUser.php.

238 {
239 global $DIC; /* @var \ILIAS\DI\Container $DIC */
240 $res = $DIC->database()->queryF(
241 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_ident = %s",
242 array('integer', 'text'),
243 array($objId, $usrIdent)
244 );
245
246 $cmixUser = new self();
247
248 while ($row = $DIC->database()->fetchAssoc($res)) {
249 $cmixUser->assignFromDbRow($row);
250 }
251
252 return $cmixUser;
253 }

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 220 of file class.ilCmiXapiUser.php.

220 : array
221 {
222 global $DIC; /* @var \ILIAS\DI\Container $DIC */
223 $res = $DIC->database()->queryF(
224 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
225 array('integer', 'integer'),
226 array($objId, $usrId)
227 );
228 $cmixUsers = array();
229 while ($row = $DIC->database()->fetchAssoc($res)) {
230 $cmixUser = new self();
231 $cmixUser->assignFromDbRow($row);
232 $cmixUsers[] = $cmixUser;
233 }
234 return $cmixUsers;
235 }

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 361 of file class.ilCmiXapiUser.php.

361 : string
362 {
363 $usrName = "";
364 switch ($userNameMode) {
366 $usrName = $user->getFirstname();
367 break;
368
370 $usrName = $user->getUTitle() ? $user->getUTitle() . ' ' : '';
371 $usrName .= $user->getLastname();
372 break;
373
375 $usrName = $user->getFullname();
376 break;
377
379 default:
380 $usrName = '-';
381 break;
382 }
383 return $usrName;
384 }
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 74 of file class.ilCmiXapiUser.php.

74 : ?int
75 {
76 return $this->objId;
77 }

References $objId.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ getPrivacyIdent()

ilCmiXapiUser::getPrivacyIdent ( )

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

84 : ?int
85 {
87 }

References $privacyIdent.

Referenced by ilLTIToolLaunchGUI\getCmixUser(), load(), and save().

+ Here is the caller graph for this function:

◆ getRegistration()

ilCmiXapiUser::getRegistration ( )

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

114 : string
115 {
116 return $this->registration;
117 }

References $registration.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRegistrationFromAuthToken()

static ilCmiXapiUser::getRegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

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

603 : Uuid
604 {
605 return (new UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getRefId() . '-' . $authToken->getUsrId());
606 }

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 153 of file class.ilCmiXapiUser.php.

153 : bool
154 {
155 return $this->satisfied;
156 }

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 419 of file class.ilCmiXapiUser.php.

419 : array
420 {
421 global $DIC; /* @var \ILIAS\DI\Container $DIC */
422
423 $res = $DIC->database()->queryF(
424 "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
425 array('integer','integer'),
426 array($objId,$usrId)
427 );
428
429 $usrIdents = [];
430 while ($row = $DIC->database()->fetchAssoc($res)) {
431 $usrIdents[] = $row['usr_ident'];
432 }
433 return $usrIdents;
434 }

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 533 of file class.ilCmiXapiUser.php.

533 : string
534 {
535 // $storedId = self::readUserObjectUniqueId();
536 // if( (bool)strlen($storedId) ) {
537 // return strstr($storedId,'@', true);
538 // }
539
540 // $getId = function( $length ) {
541 // $multiplier = floor($length/8) * 2;
542 // $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
543
544 // try {
545 // $ident = bin2hex(random_bytes($length));
546 // } catch (Exception $e) {
547 // $ident = $uid;
548 // }
549
550 // $start = rand(0, strlen($ident) - $length - 1);
551 // return substr($ident, $start, $length);
552 // };
553
554 $id = self::getUUID($length);//$getId($length);
556 while ($exists) {
557 $id = self::getUUID($length);//$getId($length);
559 }
560
561 return $id;
562 }
$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 389 of file class.ilCmiXapiUser.php.

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

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 94 of file class.ilCmiXapiUser.php.

94 : ?int
95 {
96 return $this->usrId;
97 }

References $usrId.

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

+ Here is the caller graph for this function:

◆ getUsrIdent()

ilCmiXapiUser::getUsrIdent ( )

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

104 : string
105 {
106 return $this->usrIdent;
107 }

References $usrIdent.

Referenced by ilLTIAdvantagePlatformLaunchParameterBuilder\build(), ilLTIAdvantagePlatformMembershipService\getMember(), and save().

+ Here is the caller graph for this function:

◆ getUsrIdForObjectAndUsrIdent()

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

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

608 : ?int
609 {
610 global $DIC; /* @var \ILIAS\DI\Container $DIC */
611
612 $query = "SELECT usr_id FROM " . self::DB_TABLE_NAME . " WHERE obj_id = "
613 . $DIC->database()->quote($objId, 'integer')
614 . " AND" . $DIC->database()->like('usr_ident', 'text', $userIdent . '@%');
615 $res = $DIC->database()->query($query);
616
617 $usrId = null;
618 while ($row = $DIC->database()->fetchAssoc($res)) {
619 $usrId = (int) $row['usr_id'];
620 }
621
622 return $usrId;
623 }

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

+ Here is the call graph for this function:

◆ getUUID()

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

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

564 : string
565 {
566 $multiplier = (int) floor($length / 8) * 2;
567 $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
568
569 try {
570 $ident = bin2hex(random_bytes($length));
571 } catch (Exception $e) {
572 $ident = $uid;
573 }
574
575 $start = rand(0, strlen($ident) - $length - 1);
576 return substr($ident, $start, $length);
577 }

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

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 135 of file class.ilCmiXapiUser.php.

135 : bool
136 {
137 return $this->proxySuccess;
138 }

References $proxySuccess.

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

+ Here is the caller graph for this function:

◆ load()

ilCmiXapiUser::load ( )
protected

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

168 : void
169 {
170 $res = $this->database->queryF(
171 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s",
172 array('integer', 'integer', 'integer'),
173 array($this->getObjId(), $this->getUsrId(), $this->getPrivacyIdent())
174 );
175
176 while ($row = $this->database->fetchAssoc($res)) {
177 $this->assignFromDbRow($row);
178 }
179 }

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 502 of file class.ilCmiXapiUser.php.

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

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

+ Here is the call graph for this function:

◆ save()

ilCmiXapiUser::save ( )

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

193 : void
194 {
195 global $DIC; /* @var \ILIAS\DI\Container $DIC */
196
197 if (!ilObjUser::_isAnonymous($this->getUsrId())) {
198 $DIC->database()->replace(
199 self::DB_TABLE_NAME,
200 array(
201 'obj_id' => array('integer', (int) $this->getObjId()),
202 'usr_id' => array('integer', (int) $this->getUsrId()),
203 'privacy_ident' => array('integer', (int) $this->getPrivacyIdent())
204 ),
205 array(
206 'proxy_success' => array('integer', (int) $this->hasProxySuccess()),
207 'fetched_until' => array('timestamp', $this->getFetchUntil()->get(IL_CAL_DATETIME)),
208 'usr_ident' => array('text', $this->getUsrIdent()),
209 'registration' => array('text', $this->getRegistration()),
210 'satisfied' => array('integer', (int) $this->getSatisfied())
211 )
212 );
213 }
214 }

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

+ Here is the call graph for this function:

◆ saveProxySuccess()

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

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

255 : void //TODO
256 {
257 global $DIC; /* @var \ILIAS\DI\Container $DIC */
258 $DIC->database()->update(
259 self::DB_TABLE_NAME,
260 array(
261 'proxy_success' => array('integer', 1)
262 ),
263 array(
264 'obj_id' => array('integer', (int) $objId),
265 'usr_id' => array('integer', (int) $usrId),
266 'privacy_ident' => array('integer', (int) $privacyIdent)
267 )
268 );
269 }

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 163 of file class.ilCmiXapiUser.php.

163 : void
164 {
165 $this->fetchUntil = $fetchUntil;
166 }

References $fetchUntil.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiUser::setObjId ( int  $objId)

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

79 : void
80 {
81 $this->objId = $objId;
82 }

References $objId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setPrivacyIdent()

ilCmiXapiUser::setPrivacyIdent ( int  $privacyIdent)

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

89 : void
90 {
91 $this->privacyIdent = $privacyIdent;
92 }

References $privacyIdent.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setProxySuccess()

ilCmiXapiUser::setProxySuccess ( bool  $proxySuccess)

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

140 : void
141 {
142 $this->proxySuccess = $proxySuccess;
143 }

References $proxySuccess.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setRegistration()

ilCmiXapiUser::setRegistration ( string  $registration)

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

119 : void
120 {
121 $this->registration = $registration;
122 }

References $registration.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setSatisfied()

ilCmiXapiUser::setSatisfied ( bool  $satisfied)

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

145 : void
146 {
147 $this->satisfied = $satisfied;
148 }

References $satisfied.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiUser::setUsrId ( int  $usrId)

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

99 : void
100 {
101 $this->usrId = $usrId;
102 }

References $usrId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrIdent()

ilCmiXapiUser::setUsrIdent ( string  $usrIdent)

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

109 : void
110 {
111 $this->usrIdent = $usrIdent;
112 }

References $usrIdent.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ updateFetchedUntilForObjects()

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

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

489 : void
490 {
491 global $DIC; /* @var \ILIAS\DI\Container $DIC */
492
493 $IN_objIds = $DIC->database()->in('obj_id', $objectIds, false, 'integer');
494
495 $query = "UPDATE " . self::DB_TABLE_NAME . " SET fetched_until = %s WHERE $IN_objIds";
496 $DIC->database()->manipulateF($query, array('timestamp'), array($fetchedUntil->get(IL_CAL_DATETIME)));
497 }
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 579 of file class.ilCmiXapiUser.php.

579 : bool
580 {
581 global $DIC; /* @var \ILIAS\DI\Container $DIC */
582
583 $query = "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE " . $DIC->database()->like('usr_ident', 'text', $id . '@%');
584 $result = $DIC->database()->query($query);
585 return $result->numRows() != 0;
586 }

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 53 of file class.ilCmiXapiUser.php.

◆ $fetchUntil

ilCmiXapiDateTime ilCmiXapiUser::$fetchUntil
protected

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

Referenced by getFetchUntil(), and setFetchUntil().

◆ $objId

◆ $privacyIdent

int ilCmiXapiUser::$privacyIdent
protected

◆ $proxySuccess

bool ilCmiXapiUser::$proxySuccess
protected

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

Referenced by hasProxySuccess(), and setProxySuccess().

◆ $registration

string ilCmiXapiUser::$registration
protected

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

Referenced by getRegistration(), and setRegistration().

◆ $satisfied

bool ilCmiXapiUser::$satisfied
protected

Definition at line 45 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 35 of file class.ilCmiXapiUser.php.


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