ILIAS  release_8 Revision v8.24
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 ()
 
 buildSessionKey ()
 
 getWrongEnteredPasswordLogMsg ()
 

Protected Attributes

 $rbacsystem
 
 $user
 
 $testOBJ
 
 $lng
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ buildSessionKey()

ilTestPasswordChecker::buildSessionKey ( )
protected

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

106 : string
107 {
108 return 'tst_password_' . $this->testOBJ->getTestId();
109 }

Referenced by getUserEnteredPassword(), and setUserEnteredPassword().

+ Here is the caller graph for this function:

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

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

102 {
103 return ilSession::get($this->buildSessionKey());
104 }
static get(string $a_var)

References buildSessionKey(), and ilSession\get().

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

128 : string
129 {
130 return $this->lng->txtlng(
131 'assessment',
132 'log_wrong_test_password_entered',
134 );
135 }

References ilObjAssessmentFolder\_getLogLanguage(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ isPasswordProtectionPageRedirectRequired()

ilTestPasswordChecker::isPasswordProtectionPageRedirectRequired ( )

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

55 : bool
56 {
57 if (!$this->isTestPasswordEnabled()) {
58 return false;
59 }
60
61 if ($this->isPrivilegedParticipant()) {
62 return false;
63 }
64
65 if ($this->isUserEnteredPasswordCorrect()) {
66 return false;
67 }
68
69 return true;
70 }

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

+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

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

77 : bool
78 {
79 return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
80 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

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

72 : int
73 {
74 return strlen($this->testOBJ->getPassword());
75 }

Referenced by isPasswordProtectionPageRedirectRequired().

+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

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

91 : bool
92 {
93 return $this->getUserEnteredPassword() == $this->testOBJ->getPassword();
94 }

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

112 {
114 return;
115 }
116
118 $this->user->getId(),
119 $this->testOBJ->getId(),
120 $this->getWrongEnteredPasswordLogMsg(),
121 null,
122 null,
123 true,
124 $this->testOBJ->getRefId()
125 );
126 }
static _addLog( $user_id, $object_id, $logtext, $question_id=0, $original_id=0, $test_only=false, $test_ref_id=0)
Add an assessment log entry.

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

+ Here is the call graph for this function:

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

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

97 {
98 ilSession::set($this->buildSessionKey(), $enteredPassword);
99 }
static set(string $a_var, $a_val)
Set a value.

References buildSessionKey(), and ilSession\set().

+ Here is the call graph for this function:

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

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

82 : bool
83 {
84 if (!strlen($this->getUserEnteredPassword())) {
85 return false;
86 }
87
88 return !$this->isUserEnteredPasswordCorrect();
89 }

References getUserEnteredPassword(), and isUserEnteredPasswordCorrect().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilTestPasswordChecker::$lng
protected

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

Referenced by __construct().

◆ $rbacsystem

ilTestPasswordChecker::$rbacsystem
protected

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

Referenced by __construct().

◆ $testOBJ

ilTestPasswordChecker::$testOBJ
protected

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

Referenced by __construct().

◆ $user

ilTestPasswordChecker::$user
protected

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

Referenced by __construct().


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