65 $this->proxySuccess =
false;
66 $this->satisfied =
false;
69 $this->registration =
'';
163 if (!$setting->get(
'ilias_uuid',
false)) {
165 $uuid = self::getUUID(32);
166 $setting->set(
'ilias_uuid', $uuid);
168 $ilUuid = $setting->get(
'ilias_uuid');
224 $res = $DIC->database()->queryF(
225 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s",
226 array(
'integer',
'integer',
'integer'),
230 while ($row = $DIC->database()->fetchAssoc(
$res)) {
237 $this->
setObjId((
int) $dbRow[
'obj_id']);
238 $this->
setUsrId((
int) $dbRow[
'usr_id']);
251 $DIC->database()->replace(
254 'obj_id' => array(
'integer', (
int) $this->
getObjId()),
255 'usr_id' => array(
'integer', (
int) $this->
getUsrId()),
261 'usr_ident' => array(
'text', $this->
getUsrIdent()),
263 'satisfied' => array(
'integer', (
int) $this->
getSatisfied())
272 $res = $DIC->database()->queryF(
273 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s",
274 array(
'integer',
'integer'),
277 $cmixUsers = array();
278 while ($row = $DIC->database()->fetchAssoc(
$res)) {
279 $cmixUser =
new self();
280 $cmixUser->assignFromDbRow($row);
281 $cmixUsers[] = $cmixUser;
290 $res = $DIC->database()->queryF(
291 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_ident = %s",
292 array(
'integer',
'text'),
296 $cmixUser =
new self();
298 while ($row = $DIC->database()->fetchAssoc(
$res)) {
299 $cmixUser->assignFromDbRow($row);
314 $DIC->database()->update(
317 'proxy_success' => array(
'integer', 1)
320 'obj_id' => array(
'integer', (
int)
$objId),
321 'usr_id' => array(
'integer', (
int)
$usrId),
334 switch ($userIdentMode) {
337 return self::buildPseudoEmail($user->
getId(), self::getIliasUuid());
341 return self::buildPseudoEmail($user->
getLogin(), self::getIliasUuid());
349 return self::buildPseudoEmail(
hash(
"sha256",
'' . $user->
getId() . $user->
getCreateDate()), self::getIliasUuid());
353 return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
370 switch ($userIdentMode) {
373 return $user->
getId();
389 return self::getUserObjectUniqueId();
393 return 'realemail' . $user->
getId();
406 return "{$mbox}@{$domain}.ilias";
416 switch ($userNameMode) {
446 $res = $DIC->database()->queryF(
447 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s",
454 if ($asUsrId ===
false)
456 while ($row = $DIC->database()->fetchAssoc(
$res))
458 $cmixUser =
new self();
459 $cmixUser->assignFromDbRow($row);
461 $users[] = $cmixUser;
466 while ($row = $DIC->database()->fetchAssoc(
$res))
468 $users[] = $row[
'usr_id'];
483 $res = $DIC->database()->queryF(
484 "SELECT usr_ident FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s",
485 array(
'integer',
'integer'),
490 while ($row = $DIC->database()->fetchAssoc(
$res))
492 $usrIdents[] = $row[
'usr_ident'];
504 $query =
"DELETE FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = ".$DIC->database()->quote($objId,
'integer');
505 if (count($users) == 0) {
506 $DIC->database()->manipulate(
$query);
509 $DIC->database()->manipulateF(
$query.
" AND usr_id = %s",
522 $query =
"SELECT count(*) cnt FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s";
523 $res = $DIC->database()->queryF(
525 array(
'integer',
'integer'),
531 $query =
"SELECT count(*) cnt FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s";
532 $res = $DIC->database()->queryF(
534 array(
'integer',
'integer',
'integer'),
539 while ($row = $DIC->database()->fetchAssoc(
$res)) {
540 return (
bool) $row[
'cnt'];
551 SELECT DISTINCT cu.obj_id 552 FROM " . self::DB_TABLE_NAME .
" cu 553 INNER JOIN object_data od 554 ON od.obj_id = cu.obj_id 556 WHERE cu.proxy_success != %s 559 $res = $DIC->database()->queryF(
$query, array(
'integer'), array(1));
563 while ($row = $DIC->database()->fetchAssoc(
$res)) {
564 $objects[] = $row[
'obj_id'];
574 $IN_objIds = $DIC->database()->in(
'obj_id', $objectIds,
false,
'integer');
576 $query =
"UPDATE " . self::DB_TABLE_NAME .
" SET fetched_until = %s WHERE $IN_objIds";
588 INNER JOIN object_data od 589 ON od.obj_id = cu.obj_id 590 AND od.type = {$DIC->database()->quote($type, 'text')} 596 FROM " . self::DB_TABLE_NAME .
" cu 598 WHERE cu.usr_id = {$DIC->database()->quote($usrId, 'integer')} 605 while ($row = $DIC->database()->fetchAssoc(
$res)) {
606 $objIds[] = $row[
'obj_id'];
636 $id = self::getUUID($length);
637 $exists = self::userObjectUniqueIdExists($id);
639 $id = self::getUUID($length);
640 $exists = self::userObjectUniqueIdExists($id);
649 $multiplier = floor($length/8) * 2;
650 $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
653 $ident = bin2hex(random_bytes($length));
658 $start = rand(0, strlen($ident) - $length - 1);
659 return substr($ident, $start, $length);
666 $query =
"SELECT usr_ident FROM " . self::DB_TABLE_NAME .
" WHERE " . $DIC->database()->like(
'usr_ident',
'text', $id .
'@%');
676 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(),
$objId .
'-' .
$usrId);
681 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(),$obj->
getRefId() .
'-' . $user->
getId());
686 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getObjId() .
'-' . $authToken->
getUsrId());
691 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getRefId() .
'-' . $authToken->
getUsrId());
static getInstancesByObjectIdAndUsrId($objId, $usrId)
static getName($userNameMode, ilObjUser $user)
static getUsersForObject($objId, $asUsrId=false)
__construct($objId=null, $usrId=null, $privacyIdent=null)
setFetchUntil(ilCmiXapiDateTime $fetchUntil)
static generateRegistration(ilObjCmiXapi $obj, ilObjUser $user)
getLogin()
get login / username public
static updateFetchedUntilForObjects(ilCmiXapiDateTime $fetchedUntil, $objectIds)
static getUserObjectUniqueId( $length=32)
static buildPseudoEmail($mbox, $domain)
getFirstname()
get firstname public
static getUserIdents($objId, $usrId)
getCreateDate()
get create date public
const PRIVACY_IDENT_IL_UUID_RANDOM
static userObjectUniqueIdExists($id)
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
const PRIVACY_IDENT_REAL_EMAIL
getExternalAccount()
get external account
const PRIVACY_IDENT_IL_UUID_SHA256
getEmail()
get email address public
static getCMI5RegistrationFromAuthToken(ilCmiXapiAuthToken $authToken)
getLastname()
get lastname public
foreach($_POST as $key=> $value) $res
getId()
get object id public
const PRIVACY_NAME_FIRSTNAME
static generateCMI5Registration($objId, $usrId)
static deleteUsersForObject(int $objId, ?array $users=[])
setProxySuccess($proxySuccess)
static getCmixObjectsHavingUsersMissingProxySuccess()
setUsrIdent(string $usrIdent)
setPrivacyIdent($privacyIdent)
const PRIVACY_IDENT_IL_UUID_LOGIN
get($a_format, $a_format_str='', $a_tz='')
get formatted date
getUTitle()
get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets...
static getRegistrationFromAuthToken(ilCmiXapiAuthToken $authToken)
static getIdentAsId($userIdentMode, ilObjUser $user)
const PRIVACY_IDENT_IL_UUID_USER_ID
setRegistration(string $registration)
getFullname($a_max_strlen=0)
get fullname public
static getInstanceByObjectIdAndUsrIdent($objId, $usrIdent)
static lookupObjectIds($usrId, $type='')
const PRIVACY_NAME_LASTNAME
static exists($objId, $usrId, $privacyIdent=999)
static getIdent($userIdentMode, ilObjUser $user)
const PRIVACY_NAME_FULLNAME
static saveProxySuccess($objId, $usrId, $privacyIdent)
static getUUID($length=32)