MythTV  master
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
MythUserSession Class Reference

#include <mythsession.h>

Collaboration diagram for MythUserSession:
Collaboration graph
[legend]

Public Member Functions

 MythUserSession ()=default
 
 ~MythUserSession ()
 
 MythUserSession (const MythUserSession &)=default
 
 MythUserSession (MythUserSession &&other)=default
 
MythUserSessionoperator= (const MythUserSession &)=default
 
MythUserSessionoperator= (MythUserSession &&other)=default
 
bool IsValid (void) const
 Check if this session object appears properly constructed, it DOES NOT validate whether it is a valid session with the SessionManager. More...
 
QString GetUserName (void) const
 
uint GetUserId (void) const
 
QString GetSessionToken (void) const
 
QString GetSessionClient (void) const
 
QDateTime GetSessionCreated () const
 
QDateTime GetSessionLastActive () const
 
QDateTime GetSessionExpires () const
 
bool CheckPermission (const QString &context, uint permission)
 Check if the user has the given permission in a context. More...
 

Protected Member Functions

bool Save (void)
 Save the session to the database. More...
 
bool Update (void)
 Update session expiry and access times. More...
 

Protected Attributes

uint m_userId {0}
 
QString m_name
 
QString m_sessionToken
 
QDateTime m_sessionCreated
 
QDateTime m_sessionLastActive
 
QDateTime m_sessionExpires
 
QString m_sessionClient
 
QMap< QString, uintm_permissionsList
 

Friends

class MythSessionManager
 

Detailed Description

Definition at line 16 of file mythsession.h.

Constructor & Destructor Documentation

◆ MythUserSession() [1/3]

MythUserSession::MythUserSession ( )
default

◆ ~MythUserSession()

MythUserSession::~MythUserSession ( )
inline

Definition at line 20 of file mythsession.h.

◆ MythUserSession() [2/3]

MythUserSession::MythUserSession ( const MythUserSession )
default

◆ MythUserSession() [3/3]

MythUserSession::MythUserSession ( MythUserSession &&  other)
default

Member Function Documentation

◆ operator=() [1/2]

MythUserSession& MythUserSession::operator= ( const MythUserSession )
default

◆ operator=() [2/2]

MythUserSession& MythUserSession::operator= ( MythUserSession &&  other)
default

◆ IsValid()

bool MythUserSession::IsValid ( void  ) const

Check if this session object appears properly constructed, it DOES NOT validate whether it is a valid session with the SessionManager.

A valid session object includes a user id, a session token of the correct length, a created date in the past and an expiry date in the future.

It may also require that the 'client' string is present and formatted as expected.

Definition at line 15 of file mythsession.cpp.

Referenced by HTTPRequest::Authenticated(), HTTPRequest::BasicAuthentication(), HTTPRequest::DigestAuthentication(), MythSessionManager::IsValidSession(), MythSessionManager::LoginUser(), and HTTPRequest::ParseRequest().

◆ GetUserName()

QString MythUserSession::GetUserName ( void  ) const
inline

Definition at line 39 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetUserId()

uint MythUserSession::GetUserId ( void  ) const
inline

Definition at line 40 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionToken()

QString MythUserSession::GetSessionToken ( void  ) const
inline

◆ GetSessionClient()

QString MythUserSession::GetSessionClient ( void  ) const
inline

Definition at line 43 of file mythsession.h.

◆ GetSessionCreated()

QDateTime MythUserSession::GetSessionCreated ( ) const
inline

Definition at line 45 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionLastActive()

QDateTime MythUserSession::GetSessionLastActive ( ) const
inline

Definition at line 46 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionExpires()

QDateTime MythUserSession::GetSessionExpires ( ) const
inline

◆ CheckPermission()

bool MythUserSession::CheckPermission ( const QString &  context,
uint  permission 
)

Check if the user has the given permission in a context.

This function is currently unimplemented.

Parameters
context
permission

Definition at line 37 of file mythsession.cpp.

◆ Save()

bool MythUserSession::Save ( void  )
protected

Save the session to the database.

This is intended only to be used by the SessionManager, everything except for checking perms is done in the session manager, and perms checking is only done through the MythUserSession object to

Definition at line 56 of file mythsession.cpp.

Referenced by MythSessionManager::CreateUserSession(), and Update().

◆ Update()

bool MythUserSession::Update ( void  )
protected

Update session expiry and access times.

Definition at line 101 of file mythsession.cpp.

Referenced by CheckPermission(), MythSessionManager::GetSession(), and MythSessionManager::UpdateSession().

Friends And Related Function Documentation

◆ MythSessionManager

friend class MythSessionManager
friend

Definition at line 85 of file mythsession.h.

Member Data Documentation

◆ m_userId

uint MythUserSession::m_userId {0}
protected

◆ m_name

QString MythUserSession::m_name
protected

◆ m_sessionToken

QString MythUserSession::m_sessionToken
protected

◆ m_sessionCreated

QDateTime MythUserSession::m_sessionCreated
protected

◆ m_sessionLastActive

QDateTime MythUserSession::m_sessionLastActive
protected

◆ m_sessionExpires

QDateTime MythUserSession::m_sessionExpires
protected

◆ m_sessionClient

QString MythUserSession::m_sessionClient
protected

◆ m_permissionsList

QMap<QString, uint> MythUserSession::m_permissionsList
protected

Definition at line 83 of file mythsession.h.


The documentation for this class was generated from the following files: