Kernel::System::AuthSession

NAME

Kernel::System::AuthSession – global session interface

DESCRIPTION

All session functions.

PUBLIC INTERFACE

new()

Don't use the constructor directly, use the ObjectManager instead:

    my $SessionObject = $Kernel::OM->Get('Kernel::System::AuthSession');

CheckSessionID()

checks a session, returns true (session ok) or false (session invalid)

    my $Ok = $SessionObject->CheckSessionID(
        SessionID => '1234567890123456',
    );

CheckAgentSessionLimitPriorWarning()

Get the agent session limit prior warning message, if the limit is reached.

    my $PriorMessage = $SessionObject->CheckAgentSessionLimitPriorWarning();

 returns the prior warning message (AgentSessionLimitPriorWarning reached) or false (AgentSessionLimitPriorWarning not reached)

SessionIDErrorMessage()

returns an error in the session handling

    my $Message = $SessionObject->SessionIDErrorMessage();

GetSessionIDData()

get session data in a hash

    my %Data = $SessionObject->GetSessionIDData(
        SessionID => '1234567890123456',
    );

Returns:

    %Data = (
        UserSessionStart    => '1293801801',
        UserRemoteAddr      => '127.0.0.1',
        UserRemoteUserAgent => 'Some User Agent x.x',
        UserLastname        => 'SomeLastName',
        UserFirstname       => 'SomeFirstname',
        # and all other preferences values
    );

CreateSessionID()

create a new session with given data

    my $SessionID = $SessionObject->CreateSessionID(
        UserLogin => 'root',
        UserEmail => 'root@example.com',
    );

RemoveSessionID()

removes a session and returns true (session deleted), false (if session can't get deleted)

    $SessionObject->RemoveSessionID(SessionID => '1234567890123456');

RemoveSessionByUser()

Removes a session from a user.

    $SessionObject->RemoveSessionByUser(
        UserLogin => 'some_user_login'
    );

Returns true (session deleted) or false (if session can't get deleted).

UpdateSessionID()

update session info by key and value, returns true (if ok) and false (if can't update)

    $SessionObject->UpdateSessionID(
        SessionID => '1234567890123456',
        Key       => 'LastScreenOverview',
        Value     => 'SomeInfo',
    );

GetExpiredSessionIDs()

returns a array of an array of session ids that have expired, and one array of session ids that have been idle for too long.

    my @Sessions = $SessionObject->GetExpiredSessionIDs();

    my @ExpiredSession = @{$Session[0]};
    my @ExpiredIdle    = @{$Session[1]};

GetAllSessionIDs()

returns an array with all session ids

    my @Sessions = $SessionObject->GetAllSessionIDs();

GetActiveSessions()

Get the current active sessions for the given UserType.

    my %Result = $SessionObject->GetActiveSessions(
        UserType => 'User',
    );

returns

    %Result = (
        Total => 8,
        PerUser => {
            UserID1 => 2,
            UserID2 => 1,
        },
    );

CleanUp()

clean-up of sessions in your system

    $SessionObject->CleanUp();
Scroll to Top