1<?
php declare(strict_types=1);
61 return (
new static())->tos->getStatus();
69 return $this->tos->getStatus();
78 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
79 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
81 $databaseGateway->deleteAcceptanceHistoryByUser($entity->withUserId($userId));
91 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
92 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
94 return $databaseGateway->loadCurrentAcceptanceOfUser($entity->withUserId((
int) $user->
getId()));
104 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
105 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
107 return $databaseGateway->loadById($entity->withId($id));
118 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
119 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
122 ->withUserId((
int) $user->
getId())
123 ->withTimestamp(time())
124 ->withText((
string) $document->
content())
125 ->withHash(md5($document->
content()))
126 ->withDocumentId((
int) $document->
id())
127 ->withTitle((
string) $document->
title());
130 $entity = $entity->withSerializedCriteria($criteriaBag->toJson());
132 $databaseGateway->trackAcceptance($entity);
158 (
int) $user->
getId() > 0
169 $logger->
debug(sprintf(
170 'Checking reevaluation of Terms of Service for user "%s" (id: %s) ...',
176 $logger->
debug(sprintf(
177 'Terms of Service disabled, resigning not required ...'
183 $logger->
debug(sprintf(
184 'User is not included for Terms of Service acceptance, resigning not required ...'
189 if (!$this->tos->shouldReevaluateOnLogin()) {
190 $logger->
debug(sprintf(
191 'Reevaluation of documents is not enabled, resigning not required ...'
197 $logger->
debug(sprintf(
198 'Terms of Service currently not accepted by user, resigning not required ...'
203 $evaluator = $this->termsOfServiceEvaluation->withContextUser($user);
204 if (!$evaluator->hasDocument()) {
205 $logger->
debug(sprintf(
206 'No signable Terms of Service document found, resigning not required ...'
212 if (!($entity->getId() > 0)) {
213 $logger->
debug(sprintf(
214 'No signed Terms of Service document found, resigning not required ...'
222 $this->criterionTypeFactory
225 if ($evaluator->evaluateDocument($historizedDocument)) {
226 $logger->
debug(sprintf(
227 'Current user values do still match historized criteria, resigning not required ...'
232 $logger->
debug(sprintf(
233 'Current user values do not match historized criteria, resigning required ...'
An exception for terminatinating execution or to throw for unit testing.
Component logger with individual log levels by component id.
debug($a_message, $a_context=array())
Class ilObjTermsOfService.
getAgreeDate()
get the date when the user accepted the user agreement @access public
setAgreeDate($a_str)
set date the user account was accepted by the user nullindicates that the user has not accepted his a...
writeAccepted()
write accept date of user agreement to db
getLogin()
get login / username @access public
hasToAcceptTermsOfServiceInSession($status=null)
update()
update object in db
getId()
get object id @access public
Class ilTermsOfServiceAcceptanceEntity.
Class ilTermsOfServiceAcceptanceHistoryCriteriaBag.
Class ilTermsOfServiceDataGatewayFactory.
Class ilTermsOfServiceEntityFactory.
Class ilTermsOfServiceHelper.
isIncludedUser(ilObjUser $user)
getCurrentAcceptanceForUser(ilObjUser $user)
$termsOfServiceEvaluation
__construct(ilTermsOfServiceDataGatewayFactory $dataGatewayFactory=null, ilTermsOfServiceDocumentEvaluation $termsOfServiceEvaluation=null, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory=null, ilObjTermsOfService $tos=null)
ilTermsOfServiceHelper constructor.
hasToResignAcceptance(ilObjUser $user, ilLogger $logger)
deleteAcceptanceHistoryByUser(int $userId)
resetAcceptance(ilObjUser $user)
trackAcceptance(ilObjUser $user, ilTermsOfServiceSignableDocument $document)
Class ilTermsOfServiceHistorizedDocument.
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilTermsOfServiceCriterionTypeFactoryInterface.
Interface ilTermsOfServiceDocumentEvaluation.
Interface ilTermsOfServiceSignableDocument.