3 declare(strict_types=1);
    53     public function __construct(?
int $objId = null, ?
int $usrId = null, ?
int $privacyIdent = null)
    56         $this->database = $DIC->database();
    60         $this->proxySuccess = 
false;
    61         $this->satisfied = 
false;
    64         $this->registration = 
'';
    66         if ($objId !== null && $usrId !== null && $privacyIdent !== null) {
   125         if (null == $setting->get(
'ilias_uuid', null)) {
   128             $setting->set(
'ilias_uuid', $uuid);
   130         return $setting->get(
'ilias_uuid');
   166     protected function load(): void
   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'),
   174         while ($row = $this->database->fetchAssoc(
$res)) {
   181         $this->
setObjId((
int) $dbRow[
'obj_id']);
   182         $this->
setUsrId((
int) $dbRow[
'usr_id']);
   196             $DIC->database()->replace(
   199                     'obj_id' => array(
'integer', (
int) $this->
getObjId()),
   200                     'usr_id' => array(
'integer', (
int) $this->
getUsrId()),
   206                     'usr_ident' => array(
'text', $this->
getUsrIdent()),
   208                     'satisfied' => array(
'integer', (
int) $this->
getSatisfied())
   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)
   226         $cmixUsers = array();
   227         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   228             $cmixUser = 
new self();
   229             $cmixUser->assignFromDbRow($row);
   230             $cmixUsers[] = $cmixUser;
   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)
   244         $cmixUser = 
new self();
   246         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   247             $cmixUser->assignFromDbRow($row);
   256         $DIC->database()->update(
   259                 'proxy_success' => array(
'integer', 1)
   262                 'obj_id' => array(
'integer', (
int) $objId),
   263                 'usr_id' => array(
'integer', (
int) $usrId),
   264                 'privacy_ident' => array(
'integer', (
int) $privacyIdent)
   272             return self::buildPseudoEmail(
hash(
"sha256", (
string) microtime()), self::getIliasUuid());
   274         switch ($userIdentMode) {
   277                 return self::buildPseudoEmail((
string) $user->
getId(), self::getIliasUuid());
   282                     return self::buildPseudoEmail($user->
getLogin(), self::getIliasUuid());
   294                 return self::buildPseudoEmail(
hash(
"sha256", 
'' . $user->
getId() . $user->
getCreateDate()), self::getIliasUuid());
   298                 if (strlen($tmpHash) > 80) {
   299                     $tmpHash = substr($tmpHash, strlen($tmpHash) - 80);
   305                 return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
   317         switch ($userIdentMode) {
   320                 return (
string) $user->
getId();
   336                 $tmpHost = 
'@' . str_replace(
'www.', 
'', 
$_SERVER[
'HTTP_HOST']);
   337                 if (strlen($tmpHash . $tmpHost) > 80) {
   338                     $tmpHash = substr($tmpHash, strlen($tmpHash) - (80 - strlen($tmpHost)));
   344                 return self::getUserObjectUniqueId();
   348                 return 'realemail' . $user->
getId();
   356         return "{$mbox}@{$domain}.ilias";
   362         switch ($userNameMode) {
   391         $res = $DIC->database()->queryF(
   392             "SELECT * FROM " . self::DB_TABLE_NAME . 
" WHERE obj_id = %s",
   399         if ($asUsrId === 
false) {
   400             while ($row = $DIC->database()->fetchAssoc(
$res)) {
   401                 $cmixUser = 
new self();
   402                 $cmixUser->assignFromDbRow($row);
   404                 $users[] = $cmixUser;
   407             while ($row = $DIC->database()->fetchAssoc(
$res)) {
   408                 $users[] = $row[
'usr_id'];
   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'),
   428         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   429             $usrIdents[] = $row[
'usr_ident'];
   434     public static function exists(
int $objId, 
int $usrId, 
int $privacyIdent = 999): bool
   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(
   441                 array(
'integer', 
'integer'),
   442                 array($objId, $usrId)
   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(
   448                 array(
'integer', 
'integer', 
'integer'),
   449                 array($objId, $usrId, $privacyIdent)
   453         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   454             return (
bool) $row[
'cnt'];
   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   473                         WHERE cu.proxy_success != %s   476         $res = $DIC->database()->queryF($query, array(
'integer'), array(1));
   480         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   481             $objects[] = (
int) $row[
'obj_id'];
   491         $IN_objIds = $DIC->database()->in(
'obj_id', $objectIds, 
false, 
'integer');
   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)));
   508                                 INNER JOIN object_data od   509                                 ON od.obj_id = cu.obj_id   510                                 AND od.type = {$DIC->database()->quote($type, 'text')}   516                         FROM " . self::DB_TABLE_NAME . 
" cu   518                         WHERE cu.usr_id = {$DIC->database()->quote($usrId, 'integer')}   521         $res = $DIC->database()->query($query);
   525         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   526             $objIds[] = (
int) $row[
'obj_id'];
   553         $exists = self::userObjectUniqueIdExists(
$id);
   556             $exists = self::userObjectUniqueIdExists(
$id);
   562     public static function getUUID(
int $length = 32): string
   564         $multiplier = (
int) floor($length / 8) * 2;
   565         $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
   568             $ident = bin2hex(random_bytes($length));
   573         $start = rand(0, strlen($ident) - $length - 1);
   574         return substr($ident, $start, $length);
   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;
   588         return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $objId . 
'-' . $usrId);
   593         return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $obj->
getRefId() . 
'-' . $user->
getId());
   598         return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getObjId() . 
'-' . $authToken->
getUsrId());
   603         return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getRefId() . 
'-' . $authToken->
getUsrId());
   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);
   616         while ($row = $DIC->database()->fetchAssoc(
$res)) {
   617             $usrId = (
int) $row[
'usr_id'];
   626         $query = 
"DELETE FROM cmix_users WHERE obj_id = " . $DIC->database()->quote($objId, 
'integer');
   627         if (count($users) == 0) {
   628             $DIC->database()->manipulate($query);
   630             $DIC->database()->manipulateF(
   631                 $query . 
" AND usr_id = %s",
 static getIdentAsId(int $userIdentMode, ilObjUser $user)
 
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date 
 
ilCmiXapiDateTime $fetchUntil
 
static exists(int $objId, int $usrId, int $privacyIdent=999)
 
const PRIVACY_IDENT_IL_UUID_SHA256URL
 
__construct(?int $objId=null, ?int $usrId=null, ?int $privacyIdent=null)
 
setFetchUntil(ilCmiXapiDateTime $fetchUntil)
 
static generateRegistration(ilObjCmiXapi $obj, ilObjUser $user)
 
static is_email(string $a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid. 
 
getFullname(int $a_max_strlen=0)
 
static getUsrIdForObjectAndUsrIdent(int $objId, string $userIdent)
 
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format. 
 
const PRIVACY_IDENT_IL_UUID_RANDOM
 
static generateCMI5Registration(int $objId, int $usrId)
 
static getIdent(int $userIdentMode, ilObjUser $user)
 
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
 
const PRIVACY_IDENT_REAL_EMAIL
 
static getUserObjectUniqueId(int $length=32)
 
const PRIVACY_IDENT_IL_UUID_SHA256
 
setSatisfied(bool $satisfied)
 
static getCMI5RegistrationFromAuthToken(ilCmiXapiAuthToken $authToken)
 
static getInstanceByObjectIdAndUsrIdent(int $objId, string $usrIdent)
 
const PRIVACY_NAME_FIRSTNAME
 
static saveProxySuccess(int $objId, int $usrId, int $privacyIdent)
 
static deleteUsersForObject(int $objId, ?array $users=[])
 
static getCmixObjectsHavingUsersMissingProxySuccess()
 
setUsrIdent(string $usrIdent)
 
setPrivacyIdent(int $privacyIdent)
 
setProxySuccess(bool $proxySuccess)
 
const PRIVACY_IDENT_IL_UUID_LOGIN
 
static getInstancesByObjectIdAndUsrId(int $objId, int $usrId)
 
static getRegistrationFromAuthToken(ilCmiXapiAuthToken $authToken)
 
static getUserIdents(int $objId, int $usrId)
 
static updateFetchedUntilForObjects(ilCmiXapiDateTime $fetchedUntil, array $objectIds)
 
const PRIVACY_IDENT_IL_UUID_USER_ID
 
static _isAnonymous(int $usr_id)
 
setRegistration(string $registration)
 
static buildPseudoEmail(string $mbox, string $domain)
 
const PRIVACY_NAME_LASTNAME
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
static getUUID(int $length=32)
 
const PRIVACY_NAME_FULLNAME
 
static userObjectUniqueIdExists(string $id)
 
static lookupObjectIds(int $usrId, string $type='')
 
static getName(int $userNameMode, ilObjUser $user)
 
static getUsersForObject(int $objId, bool $asUsrId=false)