#include <tConfiguration.h>
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 &) | |
tCurrentAccessLevel & | operator= (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 |
Definition at line 78 of file tConfiguration.h.
tCurrentAccessLevel::tCurrentAccessLevel | ( | tAccessLevel | newLevel, | |
bool | allowElevation = false | |||
) |
for the lifetime of this object, change the user's admit level to the passed one.
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 }
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] |
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 }
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 }
tCurrentAccessLevel& tCurrentAccessLevel::operator= | ( | tCurrentAccessLevel const & | ) | [private] |
friend class tCasacl [friend] |
Definition at line 80 of file tConfiguration.h.
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().