
###########
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:


.. code-block:: perl

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



CheckSessionID()
================


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


.. code-block:: perl

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



SessionIDErrorMessage()
=======================


returns an error in the session handling


.. code-block:: perl

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



GetSessionIDData()
==================


get session data in a hash


.. code-block:: perl

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


Returns:


.. code-block:: perl

     %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


.. code-block:: perl

     my $SessionID = $SessionObject->CreateSessionID(
         UserType      => 'User',                # required, 'User' or 'Customer'
         UserLogin     => 'root',
         UserEmail     => 'root@example.com',
         SessionSource => 'GenericInterface',    # optional, used to identify the source of the session
     );



RemoveSessionID()
=================


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


.. code-block:: perl

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



RemoveSessionByUser()
=====================


Removes a session from a user.


.. code-block:: perl

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


.. code-block:: perl

     $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.


.. code-block:: perl

     my @Sessions = $SessionObject->GetExpiredSessionIDs();
 
     my @ExpiredSession = @{$Session[0]};
     my @ExpiredIdle    = @{$Session[1]};



GetAllSessionIDs()
==================


returns an array with all session ids


.. code-block:: perl

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



GetActiveSessions()
===================


Get the current active sessions for the given UserType.


.. code-block:: perl

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


returns


.. code-block:: perl

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



GetOrphanedSessionIDs()
=======================


returns an array with orphaned session ids,
missing user-login defines an orphaned session for now


.. code-block:: perl

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



CleanUp()
=========


clean-up of sessions in your system


.. code-block:: perl

     $SessionObject->CleanUp();





