ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, and initSession().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildSessionKey()

ilTestPasswordChecker::buildSessionKey ( )
protected

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

108 {
109 return 'tst_password_'.$this->testOBJ->getTestId();
110 }

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

+ Here is the caller graph for this function:

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

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

95 {
96 return $_SESSION[$this->buildSessionKey()];
97 }
$_SESSION["AccountId"]

References $_SESSION, and buildSessionKey().

Referenced by getWrongEnteredPasswordLogMsg(), 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 $msg = $this->lng->txtlng(
127 'assessment', 'log_wrong_test_password_entered', ilObjAssessmentFolder::_getLogLanguage()
128 );
129
130 return sprintf($msg, $this->getUserEnteredPassword());
131 }
_getLogLanguage()
retrieve the log language for assessment logging

References ilObjAssessmentFolder\_getLogLanguage(), and getUserEnteredPassword().

+ Here is the call graph for this function:

◆ initSession()

ilTestPasswordChecker::initSession ( )
protected

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

100 {
101 if( !isset($_SESSION[$this->buildSessionKey()]) )
102 {
103 $_SESSION[$this->buildSessionKey()] = null;
104 }
105 }

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 {
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 }

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

+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

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

70 {
71 return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
72 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

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

65 {
66 return strlen($this->testOBJ->getPassword());
67 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

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

85 {
86 return $this->getUserEnteredPassword() == $this->testOBJ->getPassword();
87 }

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 112 of file class.ilTestPasswordChecker.php.

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 }
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not

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

+ Here is the call graph for this function:

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

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

90 {
91 $_SESSION[$this->buildSessionKey()] = $enteredPassword;
92 }

References $_SESSION, and buildSessionKey().

+ Here is the call graph for this function:

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

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

75 {
76 if( !strlen($this->getUserEnteredPassword()) )
77 {
78 return false;
79 }
80
81 return !$this->isUserEnteredPasswordCorrect();
82 }

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: