ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 107 of file class.ilTestPasswordChecker.php.

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

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

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

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

References $_SESSION, and buildSessionKey().

Referenced by getWrongEnteredPasswordLogMsg(), isUserEnteredPasswordCorrect(), and wrongUserEnteredPasswordExist().

95  {
96  return $_SESSION[$this->buildSessionKey()];
97  }
$_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(), and getUserEnteredPassword().

Referenced by logWrongEnteredPassword().

125  {
126  $msg = $this->lng->txtlng(
127  'assessment', 'log_wrong_test_password_entered', ilObjAssessmentFolder::_getLogLanguage()
128  );
129 
130  return sprintf($msg, $this->getUserEnteredPassword());
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 99 of file class.ilTestPasswordChecker.php.

References $_SESSION, and buildSessionKey().

Referenced by __construct().

100  {
101  if( !isset($_SESSION[$this->buildSessionKey()]) )
102  {
103  $_SESSION[$this->buildSessionKey()] = null;
104  }
105  }
$_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  {
48  return false;
49  }
50 
51  if( $this->isPrivilegedParticipant() )
52  {
53  return false;
54  }
55 
56  if( $this->isUserEnteredPasswordCorrect() )
57  {
58  return false;
59  }
60 
61  return true;
62  }
+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

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

Referenced by isPasswordProtectionPageRedirectRequired().

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

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

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

Referenced by isPasswordProtectionPageRedirectRequired().

65  {
66  return strlen($this->testOBJ->getPassword());
67  }
+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

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

References getUserEnteredPassword().

Referenced by isPasswordProtectionPageRedirectRequired(), and wrongUserEnteredPasswordExist().

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

◆ logWrongEnteredPassword()

ilTestPasswordChecker::logWrongEnteredPassword ( )

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

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

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

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

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

References $_SESSION, and buildSessionKey().

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

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

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

References getUserEnteredPassword(), and isUserEnteredPasswordCorrect().

75  {
76  if( !strlen($this->getUserEnteredPassword()) )
77  {
78  return false;
79  }
80 
81  return !$this->isUserEnteredPasswordCorrect();
82  }
+ 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: