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

#include <mythsession.h>

Public Member Functions

 MythUserSession ()=default
 
 ~MythUserSession ()
 
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...
 
const QString GetUserName (void) const
 
uint GetUserId (void) const
 
const QString GetSessionToken (void) const
 
const QString GetSessionClient (void) const
 
const QDateTime GetSessionCreated () const
 
const QDateTime GetSessionLastActive () const
 
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()

MythUserSession::MythUserSession ( )
default

◆ ~MythUserSession()

MythUserSession::~MythUserSession ( )
inline

Definition at line 20 of file mythsession.h.

Member Function Documentation

◆ 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::BasicAuthentication(), HTTPRequest::DigestAuthentication(), MythSessionManager::IsValidSession(), MythSessionManager::LoginUser(), and HTTPRequest::ParseRequest().

◆ GetUserName()

const QString MythUserSession::GetUserName ( void  ) const
inline

Definition at line 35 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetUserId()

uint MythUserSession::GetUserId ( void  ) const
inline

Definition at line 36 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionToken()

const QString MythUserSession::GetSessionToken ( void  ) const
inline

◆ GetSessionClient()

const QString MythUserSession::GetSessionClient ( void  ) const
inline

Definition at line 39 of file mythsession.h.

◆ GetSessionCreated()

const QDateTime MythUserSession::GetSessionCreated ( ) const
inline

Definition at line 41 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionLastActive()

const QDateTime MythUserSession::GetSessionLastActive ( ) const
inline

Definition at line 42 of file mythsession.h.

Referenced by ServerSideScripting::EvaluatePage().

◆ GetSessionExpires()

const 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(), and MythSessionManager::UpdateSession().

Friends And Related Function Documentation

◆ MythSessionManager

friend class MythSessionManager
friend

Definition at line 81 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 79 of file mythsession.h.


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