RT 4.0.24 Documentation

This version has reached its end of life and is out of support. Please contact us for upgrade assistance.

RT::CurrentUser

Go to latest version →

NAME

  RT::CurrentUser - an RT object representing the current user

SYNOPSIS

    use RT::CurrentUser;

    # load
    my $current_user = RT::CurrentUser->new;
    $current_user->Load(...);
    # or
    my $current_user = RT::CurrentUser->new( $user_obj );
    # or
    my $current_user = RT::CurrentUser->new( $address || $name || $id );

    # manipulation
    $current_user->UserObj->SetName('new_name');

DESCRIPTION

Read-only subclass of RT::User class. Used to define the current user. You should pass an instance of this class to constructors of many RT classes, then the instance used to check ACLs and localize strings.

METHODS

See also RT::User for a list of methods this class has.

new

Returns new CurrentUser object. Unlike all other classes of RT it takes either subclass of RT::User class object or scalar value that is passed to Load method.

Create, Delete and Set*

As stated above it's a subclass of RT::User, but this class is read-only and calls to these methods are illegal. Return 'permission denied' message and log an error.

UserObj

Returns the RT::User object associated with this CurrentUser object.

LoadByGecos

Loads a User into this CurrentUser object. Takes a unix username as its only argument.

LoadByName

Loads a User into this CurrentUser object. Takes a Name.

LanguageHandle

Returns this current user's langauge handle. Should take a language specification. but currently doesn't

CurrentUser

Return the current currentuser object

Authenticate

Takes $password, $created and $nonce, and returns a boolean value representing whether the authentication succeeded.

If both $nonce and $created are specified, validate $password against:

    encode_base64(sha1(
        $nonce .
        $created .
        sha1_hex( "$username:$realm:$server_pass" )
    ))

where $server_pass is the md5_hex(password) digest stored in the database, $created is in ISO time format, and $nonce is a random string no longer than 32 bytes.

← Back to index