Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
Validation Class Reference

Public Member Functions

 canAdminister ($journalId, $userId)
 
 checkCredentials ($username, $password)
 
 encryptCredentials ($username, $password, $encryption=false)
 
 generatePassword ($length=8)
 
 generatePasswordResetHash ($userId)
 
 isAuthor ($journalId=-1)
 
 isAuthorized ($roleId, $journalId=0)
 
 isCopyeditor ($journalId=-1)
 
 isEditor ($journalId=-1)
 
 isJournalManager ($journalId=-1)
 
 isLayoutEditor ($journalId=-1)
 
 isLoggedIn ()
 
 isProofreader ($journalId=-1)
 
 isReader ($journalId=-1)
 
 isReviewer ($journalId=-1)
 
 isSectionEditor ($journalId=-1)
 
 isSiteAdmin ()
 
 isSubscriptionManager ($journalId=-1)
 
login ($username, $password, &$reason, $remember=false)
 
 logout ()
 
 redirectLogin ($message=null)
 
 suggestUsername ($firstName, $lastName)
 

Detailed Description

Class providing user validation/authentication operations.

Mock implementation of the Validation class for the PKPPageRouterTest.

See Also
PKPPageRouterTest

Definition at line 18 of file Validation.inc.php.

Member Function Documentation

Validation::canAdminister (   $journalId,
  $userId 
)

Check whether a user is allowed to administer another user.

Parameters
$journalIdint
$userIdint
Returns
boolean

Definition at line 392 of file Validation.inc.php.

References DAORegistry\getDAO(), isJournalManager(), and isSiteAdmin().

Referenced by PeopleHandler\disableUser(), PeopleHandler\editUser(), PeopleHandler\mergeUsers(), LoginHandler\signInAsUser(), and PeopleHandler\updateUser().

Validation::checkCredentials (   $username,
  $password 
)

Check if a user's credentials are valid.

Parameters
$usernamestring username
$passwordstring unencrypted password
Returns
boolean

Definition at line 159 of file Validation.inc.php.

References encryptCredentials(), and DAORegistry\getDAO().

Validation::encryptCredentials (   $username,
  $password,
  $encryption = false 
)

Encrypt user passwords for database storage. The username is used as a unique salt to make dictionary attacks against a compromised database more difficult.

Parameters
$usernamestring username
$passwordstring unencrypted password
$encryptionstring optional encryption algorithm to use, defaulting to the value from the site configuration
Returns
string encrypted password

Definition at line 214 of file Validation.inc.php.

References Config\getVar().

Referenced by checkCredentials(), Install\createData(), LoginChangePasswordForm\execute(), ChangePasswordForm\execute(), CreateReviewerForm\execute(), RegistrationForm\execute(), UserManagementForm\execute(), OJSPaymentManager\fulfillQueuedPayment(), UserXMLParser\generatePassword(), UserXMLParser\importUsers(), login(), ShibAuthPlugin\registerUserFromShib(), and PKPLoginHandler\resetPassword().

Validation::generatePassword (   $length = 8)

Generate a random password. Assumes the random number generator has already been seeded.

Parameters
$lengthint the length of the password to generate (default 8)
Returns
string

Definition at line 238 of file Validation.inc.php.

Referenced by CaptchaManager\createCaptcha(), AccessKeyManager\createKey(), LoginChangePasswordForm\execute(), ChangePasswordForm\execute(), CreateReviewerForm\execute(), UserManagementForm\execute(), OJSPaymentManager\fulfillQueuedPayment(), UserXMLParser\generatePassword(), and PKPLoginHandler\resetPassword().

Validation::generatePasswordResetHash (   $userId)

Generate a hash value to use for confirmation to reset a password.

Parameters
$userIdint
Returns
string (boolean false if user is invalid)

Definition at line 254 of file Validation.inc.php.

References DAORegistry\getDAO().

Referenced by SectionEditorAction\notifyReviewer(), SectionEditorAction\remindReviewer(), PKPLoginHandler\requestResetPassword(), and PKPLoginHandler\resetPassword().

Validation::isAuthor (   $journalId = -1)
Validation::isAuthorized (   $roleId,
  $journalId = 0 
)

Check if a user is authorized to access the specified role in the specified journal.

Parameters
$roleIdint
$journalIdoptional (e.g., for global site admin role), the ID of the journal
Returns
boolean

Definition at line 186 of file Validation.inc.php.

References DAORegistry\getDAO(), Request\getJournal(), SessionManager\getManager(), and isLoggedIn().

Referenced by isAuthor(), isCopyeditor(), isEditor(), isJournalManager(), isLayoutEditor(), isProofreader(), isReader(), isReviewer(), isSectionEditor(), isSiteAdmin(), and isSubscriptionManager().

Validation::isCopyeditor (   $journalId = -1)

Shortcut for checking authorization as copyeditor.

Parameters
$journalIdint
Returns
boolean

Definition at line 346 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal().

Validation::isLayoutEditor (   $journalId = -1)

Shortcut for checking authorization as layout editor.

Parameters
$journalIdint
Returns
boolean

Definition at line 328 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal(), IssueHandler\_setupIssueTemplate(), and IssueManagementHandler\validate().

Validation::isProofreader (   $journalId = -1)

Shortcut for checking authorization as proofreader.

Parameters
$journalIdint
Returns
boolean

Definition at line 355 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal(), and IssueHandler\_setupIssueTemplate().

Validation::isReader (   $journalId = -1)

Shortcut for checking authorization as reader.

Parameters
$journalIdint
Returns
boolean

Definition at line 373 of file Validation.inc.php.

References isAuthorized().

Referenced by ProfileForm\execute(), and ProfileForm\initData().

Validation::isReviewer (   $journalId = -1)

Shortcut for checking authorization as reviewer.

Parameters
$journalIdint
Returns
boolean

Definition at line 337 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal(), NotificationSettingsForm\display(), ProfileForm\execute(), and ProfileForm\initData().

Validation::isSectionEditor (   $journalId = -1)

Shortcut for checking authorization as section editor.

Parameters
$journalIdint
Returns
boolean

Definition at line 319 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal(), NotificationSettingsForm\display(), EmailHandler\email(), and ReferralHandler\updateReferral().

Validation::isSubscriptionManager (   $journalId = -1)

Shortcut for checking authorization as subscription manager.

Parameters
$journalIdint
Returns
boolean

Definition at line 382 of file Validation.inc.php.

References isAuthorized().

Referenced by UserHandler\_getRoleDataForJournal().

& Validation::login (   $username,
  $password,
$reason,
  $remember = false 
)

Authenticate user credentials and mark the user as logged in in the current session.

Parameters
$usernamestring
$passwordstring unencrypted password
$reasonstring reference to string to receive the reason an account was disabled; null otherwise
$rememberboolean remember a user's session past the current browser session
Returns
User the User associated with the login credentials, or false if the credentials are invalid

Definition at line 28 of file Validation.inc.php.

References HookRegistry\call(), encryptCredentials(), Core\getCurrentDate(), DAORegistry\getDAO(), SessionManager\getManager(), Config\getVar(), isLoggedIn(), and PluginRegistry\loadCategory().

Referenced by PKPLoginHandler\implicitAuthReturn(), RegistrationHandler\registerUser(), PKPLoginHandler\savePassword(), and PKPLoginHandler\signIn().

Validation::logout ( )

Mark the user as logged out in the current session.

Returns
boolean

Definition at line 118 of file Validation.inc.php.

References DAORegistry\getDAO(), and SessionManager\getManager().

Referenced by PKPLoginHandler\signIn(), PKPLoginHandler\signOut(), and ReviewerHandler\validateAccessKey().

Validation::redirectLogin (   $message = null)
Validation::suggestUsername (   $firstName,
  $lastName 
)

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