first commit

This commit is contained in:
salam committed 2026-10-06 19:40:28 +02:00
commit e81864e683
2984 files changed
+267797

No files matched your search

@@ -0,0 +1,111 @@
<?php
declare(strict_types=1);
namespace In2code\Femanager\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Class Log
*/
class Log extends AbstractEntity
{
const STATUS_NEWREGISTRATION = 101;
const STATUS_REGISTRATIONCONFIRMEDUSER = 102;
const STATUS_REGISTRATIONCONFIRMEDADMIN = 103;
const STATUS_REGISTRATIONREFUSEDUSER = 104;
const STATUS_REGISTRATIONREFUSEDADMIN = 105;
const STATUS_PROFILECREATIONREQUEST = 106;
const STATUS_PROFILEUPDATED = 201;
const STATUS_PROFILEUPDATECONFIRMEDADMIN = 202;
const STATUS_PROFILEUPDATEREFUSEDADMIN = 203;
const STATUS_PROFILEUPDATEREQUEST = 204;
const STATUS_PROFILEUPDATEREFUSEDSECURITY = 205;
const STATUS_PROFILEUPDATEIMAGEDELETE = 206;
const STATUS_PROFILEUPDATEATTEMPTEDSPOOF = 207;
const STATUS_PROFILEDELETE = 301;
const STATUS_INVITATIONPROFILECREATED = 401;
const STATUS_INVITATIONPROFILEDELETEDUSER = 402;
const STATUS_INVITATIONHASHERROR = 403;
const STATUS_INVITATIONRESTRICTEDPAGE = 404;
const STATUS_INVITATIONPROFILEENABLED = 405;
/**
* title
*
* @var string
*/
protected $title;
/**
* state
*
* @var int
*/
protected $state;
/**
* user
*
* @var User
*/
protected $user;
/**
* @param string $title
* @return Log
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param int $state
* @return Log
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* @return int
*/
public function getState()
{
return $this->state;
}
/**
* Set user
*
* @param User $user
* @return Log
*/
public function setUser(User $user)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return User
*/
public function getUser()
{
return $this->user;
}
}
@@ -0,0 +1,434 @@
<?php
declare(strict_types=1);
namespace In2code\Femanager\Domain\Model;
use In2code\Femanager\Utility\UserUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Class User
*/
class User extends FrontendUser
{
const TABLE_NAME = 'fe_users';
/**
* @var string
*/
protected $txFemanagerChangerequest;
/**
* @var \DateTime
*/
protected $crdate;
/**
* @var \DateTime
*/
protected $tstamp;
/**
* @var bool
*/
protected $disable;
/**
* @var bool
*/
protected $txFemanagerConfirmedbyuser;
/**
* @var bool
*/
protected $txFemanagerConfirmedbyadmin;
/**
* @var bool
*/
protected $isOnline = false;
/**
* @var bool
*/
protected $ignoreDirty = false;
/**
* @var int
*/
protected $gender;
/**
* @var \DateTime
*/
protected $dateOfBirth;
/**
* termsAndConditions
*
* @var bool
*/
protected $terms = false;
/**
* the datetime the user accepted the terms
*
* @var \DateTime
*/
protected $termsDateOfAcceptance;
/**
* @var string
*/
protected $txExtbaseType;
/**
* Created Password in Cleartext (if generated Password)
* will of course not be persistent and lives until runtime end
*
* @var string
*/
protected $passwordAutoGenerated;
/**
* @var string
*/
protected $state = '';
public function removeAllUsergroups()
{
$this->usergroup = new ObjectStorage();
}
/**
* @param string $txFemanagerChangerequest
* @return User
*/
public function setTxFemanagerChangerequest($txFemanagerChangerequest)
{
$this->txFemanagerChangerequest = $txFemanagerChangerequest;
return $this;
}
/**
* @return string
*/
public function getTxFemanagerChangerequest()
{
return $this->txFemanagerChangerequest;
}
/**
* @param \DateTime $crdate
* @return User
*/
public function setCrdate($crdate)
{
$this->crdate = $crdate;
return $this;
}
/**
* @return \DateTime
*/
public function getCrdate()
{
if ($this->crdate === null) {
// timestamp is zero
$this->crdate = new \DateTime('01.01.1970');
}
return $this->crdate;
}
/**
* @param \DateTime $tstamp
* @return User
*/
public function setTstamp($tstamp)
{
$this->tstamp = $tstamp;
return $this;
}
/**
* @return \DateTime
*/
public function getTstamp()
{
return $this->tstamp;
}
/**
* @param bool $disable
* @return User
*/
public function setDisable($disable)
{
$this->disable = $disable;
return $this;
}
/**
* @return bool
*/
public function getDisable()
{
return $this->disable;
}
/**
* @param \bool $txFemanagerConfirmedbyadmin
* @return User
*/
public function setTxFemanagerConfirmedbyadmin($txFemanagerConfirmedbyadmin)
{
$this->txFemanagerConfirmedbyadmin = $txFemanagerConfirmedbyadmin;
return $this;
}
/**
* @return \bool
*/
public function getTxFemanagerConfirmedbyadmin()
{
return $this->txFemanagerConfirmedbyadmin;
}
/**
* @param \bool $txFemanagerConfirmedbyuser
* @return User
*/
public function setTxFemanagerConfirmedbyuser($txFemanagerConfirmedbyuser)
{
$this->txFemanagerConfirmedbyuser = $txFemanagerConfirmedbyuser;
return $this;
}
/**
* @return \bool
*/
public function getTxFemanagerConfirmedbyuser()
{
return $this->txFemanagerConfirmedbyuser;
}
/**
* @param bool $ignoreDirty
* @return User
*/
public function setIgnoreDirty($ignoreDirty)
{
$this->ignoreDirty = $ignoreDirty;
return $this;
}
/**
* @return bool
*/
public function getIgnoreDirty()
{
return $this->ignoreDirty;
}
/**
* Returns the gender
*
* @return int $gender
*/
public function getGender()
{
return $this->gender;
}
/**
* Sets the gender
*
* @param int $gender
* @return User
*/
public function setGender($gender)
{
$this->gender = $gender;
return $this;
}
/**
* Returns the dateOfBirth
*
* @return \DateTime $dateOfBirth
*/
public function getDateOfBirth()
{
return $this->dateOfBirth;
}
/**
* Sets the dateOfBirth
*
* @param \DateTime $dateOfBirth
* @return User
*/
public function setDateOfBirth($dateOfBirth)
{
if ($dateOfBirth instanceof \DateTime) {
$dateOfBirth->setTime(0, 0, 0);
}
$this->dateOfBirth = $dateOfBirth;
return $this;
}
/**
* Returns, whether the user has accepted terms and conditions
*
* @return bool
*/
public function isTerms(): bool
{
return $this->terms;
}
/**
* Set whether the user has accepted terms and conditions
*
* @param bool $terms
* @return User
*/
public function setTerms(bool $terms)
{
$this->terms = $terms;
$this->setTermsDateOfAcceptance();
return $this;
}
/**
* @return \DateTime
*/
public function getTermsDateOfAcceptance()
{
return $this->termsDateOfAcceptance;
}
/**
* set terms date to now if it's not set yet
*
* @return User
*/
protected function setTermsDateOfAcceptance()
{
if ($this->termsDateOfAcceptance === null) {
$now = new \DateTime();
$this->termsDateOfAcceptance = $now;
}
return $this;
}
/**
* @return bool
*/
public function getIsOnline(): bool
{
return $this->isOnline();
}
/**
* Check if last FE login was within the last 2h
*
* @return bool
*/
public function isOnline(): bool
{
if ($this->getLastlogin() !== null && method_exists($this->getLastlogin(), 'getTimestamp')
&& $this->getLastlogin()->getTimestamp() > (time() - 2 * 60 * 60)
&& UserUtility::checkFrontendSessionToUser($this)
) {
return true;
}
return $this->isOnline;
}
/**
* @param string $txExtbaseType
* @return User
*/
public function setTxExtbaseType($txExtbaseType)
{
$this->txExtbaseType = $txExtbaseType;
return $this;
}
/**
* @return string
*/
public function getTxExtbaseType()
{
return $this->txExtbaseType;
}
public function getFirstImage()
{
$images = $this->getImage();
foreach ($images as $image) {
return $image;
}
return null;
}
/**
* @param string $passwordAutoGenerated
* @return User
*/
public function setPasswordAutoGenerated($passwordAutoGenerated)
{
$this->passwordAutoGenerated = $passwordAutoGenerated;
return $this;
}
/**
* @return string
*/
public function getPasswordAutoGenerated()
{
return $this->passwordAutoGenerated;
}
public function getState(): string
{
return $this->state;
}
public function setState(string $state): void
{
$this->state = $state;
}
public function getInactiveSince(): ?\DateTime
{
$timestampLastSession = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('fe_sessions')
->select(['ses_tstamp'], 'fe_sessions', ['ses_userid' => $this->getUid()])
->fetchOne();
if ($timestampLastSession) {
$inactiveSince = new \DateTime();
$inactiveSince->setTimestamp($timestampLastSession);
return $inactiveSince;
}
return null;
}
/**
* Workaround to disable persistence in updateAction
*
* @param null $propertyName
* @return bool
*/
public function _isDirty($propertyName = null)
{
return $this->getIgnoreDirty() ? false : parent::_isDirty($propertyName);
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace In2code\Femanager\Domain\Model;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup;
/**
* Class UserGroup
*/
class UserGroup extends FrontendUserGroup
{
}