The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Contentment::Security::DBI - Defines a simple, but relatively complete database security model

DESCRIPTION

This module defines the basic (and generally default) security model for Contentment. It uses a database store users and groups.

Contentment::Security::DBI::User

As of this writing the majority of the fields listed below are ignored by the system. In particular, the dates for the object are not in use.

The users have the following fields:

user_id

A numeric automatically assigned number (the number itself is insignificant).

username

The user's unique identifier. It is a string containing at most 30 characters.

fullname

The user's full name. It is a string containing at most 100 characters.

email

The user's primary email address. It is a string containing at most 150 characters.

webpage

The user's web page. It is a string containing at most 150 characters.

password

The user's password. It is stored in plain text and is at most 100 characters long. I hope to add optional hashing or encryption in the future.

ctime

A field able to store the creation date of the user record.

mtime

A field able to store the last modified date of the user record.

dtime

A field able to store the deleted date of the user record. If this is non-null, then the enabled field should be false.

lastlog

A field able to store the last login date of the user.

enabled

A boolean value specifying whether the account is active or not.

user_data

A hash reference able to store any other information to be associated with the user record.

Contentment::Security::DBI::Group

Again, most of these fields aren't currently used by the system.

The fields of each group are:

group_id

This is an automatically generated ID for the group.

groupname

This is the name of the group. This is a string and at most 30 characters long.

description

This is the long name of the group. This is a string and at most 100 characters long.

ctime

A date meant to store the creation time of the group.

mtime

A date meant to store the last modified time of the group.

dtime

A date meant to store the deletion time of the group. If non-null, the enabled field should be set to true.

enabled

A boolean field stating whether the group is active or not.

group_data

A hash reference containing additional information about the group.

SECURITY MODULE METHODS

$user = Contentment::Security::DBI->check_login($username, $password)

Checks the databsae for a user named $username and verifies that the user has the given password $password. If so, the record is returned. Otherwise, this method returns undef.

$user = Contentment::Security::DBI->fetch_user($username)

Returns the user record for the username given or undef.

$group = Contentment::Security::DBI->fetch_group($gropuname)

Returns the group record for the groupname given or undef.

$users = Contentment::Security::DBI->fetch_all_users

Returns an array reference containing all user records.

$groups = Contentment::Security::DBI->fetch_all_groups

Returns an array reference containing all group records.

SEE ALSO

Contentment::Security

AUTHOR

Andrew Sterling Hanenkamp, <hanenkamp@users.sourceforge.net>

COPYRIGHT AND LICENSE

Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.

Contentment is distributed and licensed under the same terms as Perl itself.