Name
CatalystX::Usul::Users - User domain model
Version
0.6.$Revision: 1165 $
Synopsis
use CatalystX::Usul::Users;
Description
Implements the base class for user data stores. Each subclass that inherits from this should implement the required list of methods
Subroutines/Methods
new
Constructor initialises these attributes
- field_defaults
-
A hashref of the user object attributes and their default values
- sessdir
-
Path to the directory containing the user password history files and the count of failed login attempts
activate_account
Placeholder methods returns undef. May be overridden in a subclass
authenticate
Called by the "check_password" method via the factory subclass. The supplied password is encrypted and compared to the one in storage. Failures are counted and when max_login_trys are exceeded the account is disabled. Errors can be thrown for; unknown user, inactive account, expired password, maximum attempts exceeded and incorrect password
change_password
Proxies a call to update_password
which must be implemented by the subclass
check_password
This method is required by the Catalyst::Authentication::Store API. It calls the factory method in the subclass to check that the supplied password is the correct one
disable_account
Calls update_password
in the subclass to set the users encrypted password to *DISABLED thereby preventing the user from logging in
encrypt_password
$enc_pass = $self->encrypt_password( $force, $user, $old, $new, $encrypted);
Encrypts the new password and returns it. If the encrypted flag is true then new is assumed to be already encrypted and is returned unchanged. The old password is used to authenticate the user unless the force flag is true
find_user
This method is required by the Catalyst::Authentication::Store API. It returns a user object (obtained by calling "get_user") even if the user is unknown. If the user is known a list of roles that the user belongs to is also returned. Adds a weakened reference to self so that Catalyst::Authentication can call the "check_password" method
for_session
This method is required by the Catalyst::Authentication::Store API. Returns the self referential object
get
This method is required by the Catalyst::Authentication::Store API. Field accessor returns undef if the field does not exist, otherwise returns the value of the required field
get_new_user_id
Implements the algorithm that derives the username from the users first name and surname. The supplied prefix from the user profile is prepended to the generated value. If the prefix contains unique domain information then the generated username will be globally unique to the organisation
get_primary_rid
Placeholder methods returns undef. May be overridden in a subclass
get_object
This method is required by the Catalyst::Authentication::Store API. Returns the self referential object
get_user
Returns a user object for the given user id. If the user does not exist then a user object with a name of unknown is returned
get_users_by_rid
Placeholder methods returns an empty list. May be overridden in a subclass
id
This method is required by the Catalyst::Authentication::Store API. Returns the username of the user object
is_user
Returns true if the given user exists, false otherwise
list
Returns an array ref of all users
make_email_address
Takes a user if or an an attribute hash, returns a guess as to what the users email address might be
retrieve
Returns a user object for the selected user and a list of usernames
set_password
Proxies a call to update_password
which must be implemented by the subclass
_validate_password
Wraps a call to "authenticate" in a try block so that a failure to validate the password returns false rather than throwing an exception
Diagnostics
None
Configuration and Environment
None
Dependencies
- CatalystX::Usul
- CatalystX::Usul::Constants
- CatalystX::Usul::UserProfiles
- Crypt::Eksblowfish::Bcrypt
- File::MailAlias
- Sys::Hostname
- TryCatch
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Author
Peter Flanigan, <Support at RoxSoft.co.uk>
Acknowledgements
Larry Wall - For the Perl programming language
License and Copyright
Copyright (c) 2009 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE