ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

103 {
104 return 'tst_password_' . $this->testOBJ->getTestId();
105 }

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

+ Here is the caller graph for this function:

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

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

91 {
92 return $_SESSION[$this->buildSessionKey()];
93 }
$_SESSION["AccountId"]

References $_SESSION, and buildSessionKey().

Referenced by isUserEnteredPasswordCorrect(), and wrongUserEnteredPasswordExist().

+ 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.

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

References ilObjAssessmentFolder\_getLogLanguage().

+ Here is the call graph for this function:

◆ initSession()

ilTestPasswordChecker::initSession ( )
protected

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

96 {
97 if (!isset($_SESSION[$this->buildSessionKey()])) {
98 $_SESSION[$this->buildSessionKey()] = null;
99 }
100 }

References $_SESSION, and buildSessionKey().

Referenced by __construct().

+ 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.

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 }

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

+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

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

67 {
68 return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
69 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

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

62 {
63 return strlen($this->testOBJ->getPassword());
64 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

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

81 {
82 return $this->getUserEnteredPassword() == $this->testOBJ->getPassword();
83 }

References getUserEnteredPassword().

Referenced by isPasswordProtectionPageRedirectRequired(), and wrongUserEnteredPasswordExist().

+ 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.

108 {
110 return;
111 }
112
114 $this->user->getId(),
115 $this->testOBJ->getId(),
116 $this->getWrongEnteredPasswordLogMsg(),
117 null,
118 null,
119 true,
120 $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.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not

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

+ Here is the call graph for this function:

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

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

86 {
87 $_SESSION[$this->buildSessionKey()] = $enteredPassword;
88 }

References $_SESSION, and buildSessionKey().

+ Here is the call graph for this function:

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

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

72 {
73 if (!strlen($this->getUserEnteredPassword())) {
74 return false;
75 }
76
77 return !$this->isUserEnteredPasswordCorrect();
78 }

References getUserEnteredPassword(), and isUserEnteredPasswordCorrect().

+ 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: