Add a filter-by-from/to-chunk in ExitManager::List.
[UnsignedByte.git] / src / DB / Savables / GrantGroup.cpp
bloba8f2762a9c346e11fcde10b08d201f930ea0ca06
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "GrantGroup.h"
22 #include "Global.h"
23 #include "Permission.h"
24 #include "PermissionManager.h"
25 #include "TableImpls.h"
27 using mud::GrantGroup;
29 GrantGroup::GrantGroup(SavableManagerPtr grantgroup) :
30 m_grantgroup(grantgroup)
32 Assert(grantgroup);
35 GrantGroup::~GrantGroup(void)
37 Unlock();
40 const std::string& GrantGroup::getName() const
42 return m_grantgroup->getValue(db::TableImpls::Get()->GRANTGROUPS->NAME)->getStringValue();
45 value_type GrantGroup::getImplication() const
47 return m_grantgroup->getValue(db::TableImpls::Get()->GRANTGROUPS->IMPLIES)->getIntegerValue();
50 bool GrantGroup::getDefaultGrant() const
52 return m_grantgroup->getValue(db::TableImpls::Get()->GRANTGROUPS->DEFAULTGRANT)->getBoolValue();
55 bool GrantGroup::getDefaultLog() const
57 return m_grantgroup->getValue(db::TableImpls::Get()->GRANTGROUPS->DEFAULTLOG)->getBoolValue();
60 void GrantGroup::setName(const std::string& name)
62 Lock();
63 ValuePtr value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS->NAME, name));
64 m_grantgroup->setValue(value);
67 void GrantGroup::setImplication(value_type implication)
69 Lock();
70 ValuePtr value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS->IMPLIES, implication));
71 m_grantgroup->setValue(value);
74 void GrantGroup::setDefaultGrant(bool defaultgrant)
76 Lock();
77 ValuePtr value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS->DEFAULTGRANT, defaultgrant));
78 m_grantgroup->setValue(value);
81 void GrantGroup::setDefaultLog(bool defaultlog)
83 Lock();
84 ValuePtr value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS->DEFAULTLOG, defaultlog));
85 m_grantgroup->setValue(value);
88 void GrantGroup::Delete()
90 Lock();
91 m_grantgroup->erase();
94 void GrantGroup::Save()
96 Lock();
97 m_grantgroup->save();
100 void GrantGroup::Discard()
102 Lock();
103 m_grantgroup->discard();
106 bool GrantGroup::Exists()
108 Lock();
109 return m_grantgroup->exists();
112 SavableManagerPtr GrantGroup::getManager() const
114 return m_grantgroup;
118 TableImplPtr GrantGroup::getTable() const
120 return m_grantgroup->getTable();