tCurrentAccessLevel Class Reference

class managing the current access level More...

#include <tConfiguration.h>

List of all members.

Public Member Functions

 tCurrentAccessLevel (tAccessLevel newLevel, bool allowElevation=false)
 for the lifetime of this object, change the user's admit level to the passed one.
 tCurrentAccessLevel ()
 does not change the access level on construction, but resets it on destruction
 ~tCurrentAccessLevel ()

Static Public Member Functions

static tAccessLevel GetAccessLevel ()
 returns the current access level
static tString GetName (tAccessLevel level)
 returns the name of an access level

Private Member Functions

 tCurrentAccessLevel (tCurrentAccessLevel const &)
tCurrentAccessLeveloperator= (tCurrentAccessLevel const &)

Private Attributes

tAccessLevel lastLevel_
 used to restore the last admin level when the object goes out of scope

Static Private Attributes

static tAccessLevel currentLevel_ = tAccessLevel_Owner
 the current access level

Friends

class tCasacl


Detailed Description

class managing the current access level

Definition at line 78 of file tConfiguration.h.


Constructor & Destructor Documentation

tCurrentAccessLevel::tCurrentAccessLevel ( tAccessLevel  newLevel,
bool  allowElevation = false 
)

for the lifetime of this object, change the user's admit level to the passed one.

Parameters:
newLevel the new access level to set over the course of the lifetime of this object
allowElevation only if set to true, getting higher access rights is possible. Use with extreme care.

Definition at line 60 of file tConfiguration.cpp.

References currentLevel_, lastLevel_, and st_Breakpoint().

00061 {
00062     // prevent elevation
00063     if ( !allowElevation && newLevel < currentLevel_ )
00064     {
00065         // you probably want to know when this happens in the debugger
00066         st_Breakpoint();
00067         newLevel = currentLevel_;
00068     }
00069 
00070     lastLevel_ = currentLevel_;
00071     currentLevel_ = newLevel;
00072 }

Here is the call graph for this function:

tCurrentAccessLevel::tCurrentAccessLevel (  ) 

does not change the access level on construction, but resets it on destruction

Definition at line 75 of file tConfiguration.cpp.

References currentLevel_, and lastLevel_.

00076 {
00077     lastLevel_ = currentLevel_;
00078 }

tCurrentAccessLevel::~tCurrentAccessLevel (  ) 

Definition at line 80 of file tConfiguration.cpp.

References currentLevel_, and lastLevel_.

00081 {
00082     currentLevel_ = lastLevel_;
00083 }

tCurrentAccessLevel::tCurrentAccessLevel ( tCurrentAccessLevel const &   )  [private]


Member Function Documentation

tAccessLevel tCurrentAccessLevel::GetAccessLevel (  )  [static]

returns the current access level

Definition at line 86 of file tConfiguration.cpp.

References currentLevel_.

Referenced by eVoteItem::CheckValid(), tConfItemBase::LoadLine(), se_ListPlayers(), and eAccessLevelHolder::SetAccessLevel().

00087 {
00088     return currentLevel_;
00089 }

Here is the caller graph for this function:

tString tCurrentAccessLevel::GetName ( tAccessLevel  level  )  [static]

returns the name of an access level

Definition at line 92 of file tConfiguration.cpp.

Referenced by eVoteItem::CheckValid(), tConfItemBase::LoadLine(), se_ListPlayers(), and ePlayerNetID::TeamChangeAllowed().

00093 {
00094     std::ostringstream s;
00095     s << "$config_accesslevel_" << level;
00096     return tString( tOutput( s.str().c_str() ) );
00097 }

Here is the caller graph for this function:

tCurrentAccessLevel& tCurrentAccessLevel::operator= ( tCurrentAccessLevel const &   )  [private]


Friends And Related Function Documentation

friend class tCasacl [friend]

Definition at line 80 of file tConfiguration.h.


Member Data Documentation

tAccessLevel tCurrentAccessLevel::lastLevel_ [private]

used to restore the last admin level when the object goes out of scope

Definition at line 98 of file tConfiguration.h.

Referenced by tCurrentAccessLevel(), and ~tCurrentAccessLevel().

tAccessLevel tCurrentAccessLevel::currentLevel_ = tAccessLevel_Owner [static, private]

the current access level

Definition at line 99 of file tConfiguration.h.

Referenced by GetAccessLevel(), tCurrentAccessLevel(), and ~tCurrentAccessLevel().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:56:02 2008 for Armagetron Advanced by  doxygen 1.5.4