1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
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. *
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. *
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"
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
)
35 GrantGroup::~GrantGroup(void)
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
)
63 ValuePtr
value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS
->NAME
, name
));
64 m_grantgroup
->setValue(value
);
67 void GrantGroup::setImplication(value_type implication
)
70 ValuePtr
value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS
->IMPLIES
, implication
));
71 m_grantgroup
->setValue(value
);
74 void GrantGroup::setDefaultGrant(bool defaultgrant
)
77 ValuePtr
value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS
->DEFAULTGRANT
, defaultgrant
));
78 m_grantgroup
->setValue(value
);
81 void GrantGroup::setDefaultLog(bool defaultlog
)
84 ValuePtr
value(new FieldValue(db::TableImpls::Get()->GRANTGROUPS
->DEFAULTLOG
, defaultlog
));
85 m_grantgroup
->setValue(value
);
88 void GrantGroup::Delete()
91 m_grantgroup
->erase();
94 void GrantGroup::Save()
100 void GrantGroup::Discard()
103 m_grantgroup
->discard();
106 bool GrantGroup::Exists()
109 return m_grantgroup
->exists();
112 SavableManagerPtr
GrantGroup::getManager() const
118 TableImplPtr
GrantGroup::getTable() const
120 return m_grantgroup
->getTable();