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())
273 $res = $DIC->database()->queryF(
274 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s",
275 array(
'integer',
'integer'),
278 $cmixUsers = array();
279 while ($row = $DIC->database()->fetchAssoc(
$res)) {
280 $cmixUser =
new self();
281 $cmixUser->assignFromDbRow($row);
282 $cmixUsers[] = $cmixUser;
291 $res = $DIC->database()->queryF(
292 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_ident = %s",
293 array(
'integer',
'text'),
297 $cmixUser =
new self();
299 while ($row = $DIC->database()->fetchAssoc(
$res)) {
300 $cmixUser->assignFromDbRow($row);
315 $DIC->database()->update(
318 'proxy_success' => array(
'integer', 1)
321 'obj_id' => array(
'integer', (
int)
$objId),
322 'usr_id' => array(
'integer', (
int)
$usrId),
336 return self::buildPseudoEmail(
hash(
"sha256", (
string) microtime()), self::getIliasUuid());
338 switch ($userIdentMode) {
341 return self::buildPseudoEmail($user->
getId(), self::getIliasUuid());
346 return self::buildPseudoEmail($user->
getLogin(), self::getIliasUuid());
358 return self::buildPseudoEmail(
hash(
"sha256",
'' . $user->
getId() . $user->
getCreateDate()), self::getIliasUuid());
362 if (strlen($tmpHash) > 80) {
363 $tmpHash = substr($tmpHash, strlen($tmpHash) - 80);
369 return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
386 switch ($userIdentMode) {
389 return $user->
getId();
405 $tmpHost =
'@' . str_replace(
'www.',
'',
$_SERVER[
'HTTP_HOST']);
406 if (strlen($tmpHash . $tmpHost) > 80) {
407 $tmpHash = substr($tmpHash, strlen($tmpHash) - (80 - strlen($tmpHost)));
413 return self::getUserObjectUniqueId();
417 return 'realemail' . $user->
getId();
430 return "{$mbox}@{$domain}.ilias";
440 switch ($userNameMode) {
470 $res = $DIC->database()->queryF(
471 "SELECT * FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s",
478 if ($asUsrId ===
false) {
479 while ($row = $DIC->database()->fetchAssoc(
$res)) {
480 $cmixUser =
new self();
481 $cmixUser->assignFromDbRow($row);
483 $users[] = $cmixUser;
486 while ($row = $DIC->database()->fetchAssoc(
$res)) {
487 $users[] = $row[
'usr_id'];
502 $res = $DIC->database()->queryF(
503 "SELECT usr_ident FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s",
504 array(
'integer',
'integer'),
509 while ($row = $DIC->database()->fetchAssoc(
$res)) {
510 $usrIdents[] = $row[
'usr_ident'];
522 $query =
"DELETE FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = " . $DIC->database()->quote($objId,
'integer');
523 if (count($users) == 0) {
524 $DIC->database()->manipulate(
$query);
526 $DIC->database()->manipulateF(
527 $query .
" AND usr_id = %s",
539 $query =
"SELECT count(*) cnt FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s";
540 $res = $DIC->database()->queryF(
542 array(
'integer',
'integer'),
546 $query =
"SELECT count(*) cnt FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s";
547 $res = $DIC->database()->queryF(
549 array(
'integer',
'integer',
'integer'),
554 while ($row = $DIC->database()->fetchAssoc(
$res)) {
555 return (
bool) $row[
'cnt'];
566 SELECT DISTINCT cu.obj_id 567 FROM " . self::DB_TABLE_NAME .
" cu 568 INNER JOIN object_data od 569 ON od.obj_id = cu.obj_id 571 WHERE cu.proxy_success != %s 574 $res = $DIC->database()->queryF(
$query, array(
'integer'), array(1));
578 while ($row = $DIC->database()->fetchAssoc(
$res)) {
579 $objects[] = $row[
'obj_id'];
589 $IN_objIds = $DIC->database()->in(
'obj_id', $objectIds,
false,
'integer');
591 $query =
"UPDATE " . self::DB_TABLE_NAME .
" SET fetched_until = %s WHERE $IN_objIds";
603 INNER JOIN object_data od 604 ON od.obj_id = cu.obj_id 605 AND od.type = {$DIC->database()->quote($type, 'text')} 611 FROM " . self::DB_TABLE_NAME .
" cu 613 WHERE cu.usr_id = {$DIC->database()->quote($usrId, 'integer')} 620 while ($row = $DIC->database()->fetchAssoc(
$res)) {
621 $objIds[] = $row[
'obj_id'];
651 $id = self::getUUID($length);
652 $exists = self::userObjectUniqueIdExists($id);
654 $id = self::getUUID($length);
655 $exists = self::userObjectUniqueIdExists($id);
663 $multiplier = floor($length / 8) * 2;
664 $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
667 $ident = bin2hex(random_bytes($length));
672 $start = rand(0, strlen($ident) - $length - 1);
673 return substr($ident, $start, $length);
680 $query =
"SELECT usr_ident FROM " . self::DB_TABLE_NAME .
" WHERE " . $DIC->database()->like(
'usr_ident',
'text', $id .
'@%');
690 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(),
$objId .
'-' .
$usrId);
695 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $obj->
getRefId() .
'-' . $user->
getId());
700 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getObjId() .
'-' . $authToken->
getUsrId());
705 return (
new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->
getRefId() .
'-' . $authToken->
getUsrId());
static getInstancesByObjectIdAndUsrId($objId, $usrId)
static getName($userNameMode, ilObjUser $user)
const PRIVACY_IDENT_IL_UUID_SHA256URL
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 buildPseudoEmail($mbox, $domain)
getFirstname()
get firstname public
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
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 _isAnonymous($usr_id)
static getInstanceByObjectIdAndUsrIdent($objId, $usrIdent)
static lookupObjectIds($usrId, $type='')
const PRIVACY_NAME_LASTNAME
static exists($objId, $usrId, $privacyIdent=999)
static getIdent($userIdentMode, ilObjUser $user)
static getUserObjectUniqueId($length=32)
const PRIVACY_NAME_FULLNAME
static saveProxySuccess($objId, $usrId, $privacyIdent)
static getUUID($length=32)