ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

Referenced by getUserEnteredPassword(), and setUserEnteredPassword().

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

◆ getUserEnteredPassword()

ilTestPasswordChecker::getUserEnteredPassword ( )
protected

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

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

Referenced by isUserEnteredPasswordCorrect(), and wrongUserEnteredPasswordExist().

102  {
103  return ilSession::get($this->buildSessionKey());
104  }
static get(string $a_var)
+ 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.

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

Referenced by logWrongEnteredPassword().

128  : string
129  {
130  return $this->lng->txtlng(
131  'assessment',
132  'log_wrong_test_password_entered',
134  );
135  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPasswordProtectionPageRedirectRequired()

ilTestPasswordChecker::isPasswordProtectionPageRedirectRequired ( )

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

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

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  }
+ Here is the call graph for this function:

◆ isPrivilegedParticipant()

ilTestPasswordChecker::isPrivilegedParticipant ( )
protected

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

Referenced by isPasswordProtectionPageRedirectRequired().

77  : bool
78  {
79  return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
80  }
+ Here is the caller graph for this function:

◆ isTestPasswordEnabled()

ilTestPasswordChecker::isTestPasswordEnabled ( )
protected

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

Referenced by isPasswordProtectionPageRedirectRequired().

72  : int
73  {
74  return strlen($this->testOBJ->getPassword());
75  }
+ Here is the caller graph for this function:

◆ isUserEnteredPasswordCorrect()

ilTestPasswordChecker::isUserEnteredPasswordCorrect ( )

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

References getUserEnteredPassword().

Referenced by isPasswordProtectionPageRedirectRequired(), and wrongUserEnteredPasswordExist().

91  : bool
92  {
93  return $this->getUserEnteredPassword() == $this->testOBJ->getPassword();
94  }
+ 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.

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

112  {
114  return;
115  }
116 
118  $this->user->getId(),
119  $this->testOBJ->getId(),
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.
+ Here is the call graph for this function:

◆ setUserEnteredPassword()

ilTestPasswordChecker::setUserEnteredPassword (   $enteredPassword)

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

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

97  {
98  ilSession::set($this->buildSessionKey(), $enteredPassword);
99  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ wrongUserEnteredPasswordExist()

ilTestPasswordChecker::wrongUserEnteredPasswordExist ( )

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

References getUserEnteredPassword(), and isUserEnteredPasswordCorrect().

82  : bool
83  {
84  if (!strlen($this->getUserEnteredPassword())) {
85  return false;
86  }
87 
88  return !$this->isUserEnteredPasswordCorrect();
89  }
+ 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: