ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestPasswordChecker Class Reference
+ Collaboration diagram for ilTestPasswordChecker:

Public Member Functions

 __construct (ilRbacSystem $rbacsystem, ilObjUser $user, ilObjTest $testOBJ, ilLanguage $lng)
 
 isPasswordProtectionPageRedirectRequired ()
 
 wrongUserEnteredPasswordExist ()
 
 isUserEnteredPasswordCorrect ()
 
 setUserEnteredPassword ($enteredPassword)
 
 logWrongEnteredPassword ()
 

Protected Member Functions

 isTestPasswordEnabled ()
 
 isPrivilegedParticipant ()
 
 getUserEnteredPassword ()
 
 initSession ()
 
 buildSessionKey ()
 
 getWrongEnteredPasswordLogMsg ()
 

Protected Attributes

 $rbacsystem
 
 $user
 
 $testOBJ
 
 $lng
 

Detailed Description

Definition at line 12 of file class.ilTestPasswordChecker.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestPasswordChecker::__construct ( ilRbacSystem  $rbacsystem,
ilObjUser  $user,
ilObjTest  $testOBJ,
ilLanguage  $lng 
)

Definition at line 34 of file class.ilTestPasswordChecker.php.

References $lng, $rbacsystem, $testOBJ, $user, initSession(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildSessionKey()

ilTestPasswordChecker::buildSessionKey ( )
protected

Definition at line 102 of file class.ilTestPasswordChecker.php.

Referenced by getUserEnteredPassword(), initSession(), and setUserEnteredPassword().

103  {
104  return 'tst_password_' . $this->testOBJ->getTestId();
105  }
+ Here is the caller graph for this function:

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

Definition at line 90 of file class.ilTestPasswordChecker.php.

References $_SESSION, and buildSessionKey().

Referenced by isUserEnteredPasswordCorrect(), and wrongUserEnteredPasswordExist().

91  {
92  return $_SESSION[$this->buildSessionKey()];
93  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWrongEnteredPasswordLogMsg()

ilTestPasswordChecker::getWrongEnteredPasswordLogMsg ( )
protected

Definition at line 124 of file class.ilTestPasswordChecker.php.

References ilObjAssessmentFolder\_getLogLanguage().

Referenced by logWrongEnteredPassword().

125  {
126  return $this->lng->txtlng(
127  'assessment',
128  'log_wrong_test_password_entered',
130  );
131  }
static _getLogLanguage()
retrieve the log language for assessment logging
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSession()

ilTestPasswordChecker::initSession ( )
protected

Definition at line 95 of file class.ilTestPasswordChecker.php.

References $_SESSION, and buildSessionKey().

Referenced by __construct().

96  {
97  if (!isset($_SESSION[$this->buildSessionKey()])) {
98  $_SESSION[$this->buildSessionKey()] = null;
99  }
100  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPasswordProtectionPageRedirectRequired()

ilTestPasswordChecker::isPasswordProtectionPageRedirectRequired ( )

Definition at line 44 of file class.ilTestPasswordChecker.php.

References isPrivilegedParticipant(), isTestPasswordEnabled(), and isUserEnteredPasswordCorrect().

45  {
46  if (!$this->isTestPasswordEnabled()) {
47  return false;
48  }
49 
50  if ($this->isPrivilegedParticipant()) {
51  return false;
52  }
53 
54  if ($this->isUserEnteredPasswordCorrect()) {
55  return false;
56  }
57 
58  return true;
59  }
+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

Definition at line 66 of file class.ilTestPasswordChecker.php.

Referenced by isPasswordProtectionPageRedirectRequired().

67  {
68  return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
69  }
+ Here is the caller graph for this function:

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

Definition at line 61 of file class.ilTestPasswordChecker.php.

Referenced by isPasswordProtectionPageRedirectRequired().

62  {
63  return strlen($this->testOBJ->getPassword());
64  }
+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

Definition at line 80 of file class.ilTestPasswordChecker.php.

References getUserEnteredPassword().

Referenced by isPasswordProtectionPageRedirectRequired(), and wrongUserEnteredPasswordExist().

81  {
82  return $this->getUserEnteredPassword() == $this->testOBJ->getPassword();
83  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logWrongEnteredPassword()

ilTestPasswordChecker::logWrongEnteredPassword ( )

Definition at line 107 of file class.ilTestPasswordChecker.php.

References ilObjAssessmentFolder\_addLog(), ilObjAssessmentFolder\_enabledAssessmentLogging(), getWrongEnteredPasswordLogMsg(), and user().

108  {
110  return;
111  }
112 
114  $this->user->getId(),
115  $this->testOBJ->getId(),
117  null,
118  null,
119  true,
120  $this->testOBJ->getRefId()
121  );
122  }
user()
Definition: user.php:4
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
+ Here is the call graph for this function:

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

Definition at line 85 of file class.ilTestPasswordChecker.php.

References $_SESSION, and buildSessionKey().

86  {
87  $_SESSION[$this->buildSessionKey()] = $enteredPassword;
88  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

Definition at line 71 of file class.ilTestPasswordChecker.php.

References getUserEnteredPassword(), and isUserEnteredPasswordCorrect().

72  {
73  if (!strlen($this->getUserEnteredPassword())) {
74  return false;
75  }
76 
77  return !$this->isUserEnteredPasswordCorrect();
78  }
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilTestPasswordChecker::$lng
protected

Definition at line 32 of file class.ilTestPasswordChecker.php.

Referenced by __construct().

◆ $rbacsystem

ilTestPasswordChecker::$rbacsystem
protected

Definition at line 17 of file class.ilTestPasswordChecker.php.

Referenced by __construct().

◆ $testOBJ

ilTestPasswordChecker::$testOBJ
protected

Definition at line 27 of file class.ilTestPasswordChecker.php.

Referenced by __construct().

◆ $user

ilTestPasswordChecker::$user
protected

Definition at line 22 of file class.ilTestPasswordChecker.php.

Referenced by __construct().


The documentation for this class was generated from the following file: