The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

CatalystX::Usul::Model::Users - Catalyst user model

Version

Describes v0.16.$Rev: 1 $

Synopsis

   package YourApp;

   use Catalyst qw(ConfigComponents...);

   __PACKAGE__->config(
     'Model::UsersDBIC'          => {
        parent_classes           => 'CatalystX::Usul::Model::Users',
        domain_attributes        => {
           dbic_user_class       => 'Authentication::Users',
           dbic_role_class       => 'Authentication::Roles',
           dbic_user_roles_class => 'Authentication::UserRoles',
           role_class            => 'CatalystX::Usul::Roles::DBIC', },
        domain_class             => 'CatalystX::Usul::Users::DBIC',
        role_model_class         => 'RolesDBIC',
        template_attributes      => {
           COMPILE_DIR           => '__appldir(var/tmp)__',
           INCLUDE_PATH          => '__appldir(var/root/templates)__', }, }, );

Description

Forms and actions for user maintenance

Configuration and Environment

Defines the following list of attributes;

default_realm

A required non-empty simple string. The name of the default authentication realm

email_attributes

A hash ref used to provide static config for the user registration email

register_authorise

A boolean which defaults to false. If true then new user registrations require authorisation before the account is created

register_queue_path

Pathname to the file which contains the list of pending user registrations

role_model_class

Class of the role model

rprtdir

Directory location in the filesystem of the user reports

template_dir

Path to the directory which contains the user registration email template

user_model_classes

Hash ref containing the map between realm names and storage model classes. Initialised by "COMPONENT"

Subroutines/Methods

COMPONENT

Constructor initialises default attribute values

build_per_context_instance

Completes the initialisation process on a per request basis

activate_account_form

   $self->activate_account_form( $filename );

Checks for the existence of the file created by the "register" method. If it exists it contains the username of a recently created account. The accounts active attribute is set to true, enabling the account

authenticate

   $self->authenticate;

Calls authenticate in the domain model.

Authenticate the user. If another controller was wanted and the user was forced to authenticate first, redirect the session to the originally requested controller. This was stored in the session by the auto method prior to redirecting to the authentication controller which forwarded to here

Redirects to the change password form it the users password has expired

authentication_form

   $self->authentication_form( $username );

Adds fields to the stash for the login screen

change_password

   $bool = $self->change_password;

Method to change the users password. Throws exceptions for field constraint failures and if the passwords entered are not the same

change_password_form

   $self->change_password_form( $username );

Adds field data to the stash for the change password screen. Allows users to change their own password

create_or_update

   $username = $self->create_or_update;

Method to create a new account or update an existing one. Throws exceptions for field constraint failures. Calls methods on the domain model to do the actual work

delete

   $bool = $self->delete;

Deletes the selected account

find_user

   $user_object = $self->find_user( $username, $verbose );

Calls find_user on the domain model. The verbose flag maximises the information returned about the user

get_user_model_class

   ($model_class, $realm) = $self->get_user_model_class( $default, $realm );

Return the user model class for the specified realm. If not found return the default user model

invalidate_cache

   $self->invalidate_cache;

Invalidates the user cache in the domain model

is_user

   $bool = $self->is_user( $username );

Calls is_user in the domain model

list

Proxy the call to the domain method

logout

   $bool = $self->logout( $args );

Expires the user object on the session store. The $args hash takes an optional message attribute and an optional no_redirect attribute

profiles

   $profile_object = $self->profiles;

Returns the domain model's profiles object

purge

   $bool = $self->purge;

Delete the list of selected accounts

register

   $bool = $self->register( [ $path ] );

Create the self registered account. The account is created in an inactive state and a confirmation email is sent

register_form

   $self->register_form( $captcha_action_path );

Added the fields to the stash for the self registration screen. Users can use this screen to create their own accounts

set_password

   $bool = $self->set_password;

Sets the users password to a given value

user_fill

   $bool = $self->user_fill;

Sets the fill attribute of the stash in response to clicking the auto fill button

user_manager_form

   $self->user_manager_form( $username );

Adds fields to the stash for the user management screen. Administrators can create new accounts or modify the details of existing ones

user_report

   $bool = $self->user_report( $type );

Creates a report of the user accounts in this realm

user_report_form

   $self->user_report_form( $id );

View either the list of available account reports or the contents of a specific report

user_security_form

   $self->user_security_form( $username );

Add fields to the stash for the security administration screen. From here administrators can reset passwords and change the list of roles to which the selected user belongs

Diagnostics

None

Dependencies

CatalystX::Usul::TraitFor::Captcha
CatalystX::Usul::TraitFor::Email
CatalystX::Usul::Model
Class::Usul::Time

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) 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