Tara Andrews > Text-Tradition-Directory > Text::Tradition::User

Download:
Text-Tradition-Directory-1.2.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Text::Tradition::User - Users which own traditions, and can login to the web app

SYNOPSIS ^

    ## Users are managed by Text::Tradition::Directory

    my $userstore = Text::Tradition::Directory->new(dsn => 'dbi:SQLite:foo.db');
    my $newuser = $userstore->add_user({ username => 'fred',
                                         password => 'somepassword' });

    my $fetchuser = $userstore->find_user({ username => 'fred' });
    if($fetchuser->check_password('somepassword')) { 
       ## login user or .. whatever
    }

    my $user = $userstore->deactivate_user({ username => 'fred' });
    if(!$user->active) { 
      ## shouldnt be able to login etc
    }

    foreach my $t (@{ $user->traditions }) {
      ## do something with traditions owned by this user.
    }

DESCRIPTION ^

User objects representing owners of Text::Traditions and authenticated users.

ATTRIBUTES

id

Inherited from KiokuX::User, stores the 'username' (login) of the user.

password

User's password, encrypted on creation (by "crypt_password" in KiokuX::User::Util.

active

Active flag, defaults to true (1). Will be set to false (0) by "deactivate_user" in Text::Tradition::UserStore.

traditions

Returns an ArrayRef of Text::Tradition objects belonging to this user.

METHODS ^

check_password

Inherited from KiokuX::User, verifies a given password string against the stored encrypted version.

add_tradition( $tradition )

Assigns the given tradition to this user.

remove_tradition( $tradition )

Removes the specified tradition from the control of this user.

is_admin

Returns true if this user has administrative privileges.

syntax highlighting: