CatalystX::Usul::Users - User domain model
Describes v0.17.$Rev: 1 $
package CatalystX::Usul::Users::DBIC; extends CatalystX::Usul::Users;
Implements the base class for user objects. Each subclass that inherits from this should implement the required list of methods
Defines the following attributes
alias_class
A loadable class which defaults to File::MailAlias
aliases
An instance of the alias_class attribute
cache
A hash ref that caches CatalystX::Usul::Response::Users objects
def_passwd
Default password string which defaults *DISABLED*
load_factor
Integer which defaults to 14. Used by Crypt::Eksblowfish::Bcrypt to determine how expensive the key distribution algorithm should be
locale
The language used to localize text, defaults to en_GB
en_GB
max_login_trys
Maximum number of login attempts before an account is disabled. An integer that defaults to 3
max_pass_hist
Maximum number of previous password to store thereby preventing reuse. An integer that defaults to 10
min_name_len
Minimum combined length of the users first and last names. Used to create the account name. An integer that defaults to 6
passwd_type
Default encryption algorithm to use when encrypting passwords. A string that defaults to Blowfish
profile_class
A loadable class which defaults to CatalystX::Usul::UserProfiles
profiles
An instance of the profile_class
role_cache
A hash ref that caches CatalystX::Usul::Role objects
role_class
A required loadable class which defaults to Class::Null
roles
An instance of the role_class
sessdir
Path to the directory containing the user password history files and the count of failed login attempts. Location of used user passwords and account activation keys
user_pattern
The default pattern used to filter user accounts. A string that defaults to \A [a-zA-Z0-9]+
userid_len
The length of the generated user id, without the prefix. An integer that defaults to 3
Activation is not currently supported by the base user store
$user_obj = $self->authenticate( $test_for_expired, $username, $password );
Called by the check_password method in the user response class. If the $test_for_expired flag is true then the accounts password must not have expired or an exception will be thrown. 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
check_password
$test_for_expired
$self->change_password( $username, $old, $new, $encrypted );
Proxies a call to update_password which must be implemented by the subclass. Requires the user to authenticate
update_password
$username = $self->dequeue_activation_file( $file );
Reads and deletes the supplied activation file. Returns the username
$self->disable_account( $user );
Calls update_password in the subclass to set the users encrypted password to *DISABLED* thereby preventing the user from logging in
$enc_pass = $self->encrypt_password( $force, $username, $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
$user_obj = $self->find_user( $username, [ $verbose ] );
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 on the response class. If the $verbose flag is true will load additional information about the user, e.g. their .project
$verbose
$user_id = $self->get_new_user_id( $first_name, $last_name, [ $prefix ] );
Implements the algorithm that derives the username from the users first name and last name. 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
$role_id = $self->get_primary_rid( $username );
Placeholder methods returns undef. May be overridden in a subclass
$user_security_ref = $self->get_security_data( $username, $password_type );
Returns a hash ref of security data about the requested user.
$user_obj = $self->get_user( $username, [ $verbose ] );
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. If the $verbose flag is true will load additional information about the user, e.g. their .project
$user_data_ref = $self->get_user_data( \%options, $username );
Returns a hash ref of data about the requested user. Includes the fields from "find_user" plus profile data
@user_list = $self->get_users_by_rid( $role_id );
Placeholder methods returns an empty list. May be overridden in a subclass
$self->invalidate_cache;
Marks the user and role caches as invalid thereby forcing a reload
$self->invalidate_user_cache;
Marks the user cache as invalid thereby forcing a reload
$bool = $self->is_user( $username );
Returns true if the given user exists, false otherwise
$user_list = $self->list( [ $pattern ] );
Returns an array ref of all users whose ids match the optional pattern
$localised_text = $self->loc( $key, @args );
Return text localised to a given language
$list_of_list_of_localisable_messages = $self->register( $args, $fields );
Create a new self registered user
@localisable_message = $self->register_authorisation( $fields );
Write the user data fields to disk and await authorisation before creating the new user
$self->set_password( $username, $new, $encrypted );
Proxies a call to update_password which must be implemented by the subclass. Does not require user authentication
$bool = $self->supports( @spec );
Returns true if the hash returned by our get_features attribute contains all the elements of the required specification
@attribute_list = $self->user_attributes
Class methods returns the list of attributes supported by the CatalystX::Usul::Response::Users response object
$bool = $self->validate_password( $username, $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
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
<Support at RoxSoft.co.uk>
Larry Wall - For the Perl programming language
Copyright (c) 2014 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
To install CatalystX::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Usul
CPAN shell
perl -MCPAN -e shell install CatalystX::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.