summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-01-18 16:40:22 +0100
committerPhilipp Sehmisch <mana@crushnet.org>2010-01-18 16:47:29 +0100
commit757e2a56e546d7e266660e9670a14d8043924cb2 (patch)
treeefe0ae9c0c2bf359225925eb021c2fd696a97d44
parentdfc6875e292e6b4ff26506a42d4becbe440e61fc (diff)
downloadmanaserv-757e2a56e546d7e266660e9670a14d8043924cb2.tar.gz
manaserv-757e2a56e546d7e266660e9670a14d8043924cb2.tar.bz2
manaserv-757e2a56e546d7e266660e9670a14d8043924cb2.tar.xz
manaserv-757e2a56e546d7e266660e9670a14d8043924cb2.zip
Reverted the accountserver-affecting changes of commits a9a87aea and dfc6875e - doesn't work out the way I planned.
-rw-r--r--accountserver.cbp2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/account-server/accounthandler.cpp5
-rw-r--r--src/account-server/storage.cpp3
-rw-r--r--src/chat-server/chathandler.cpp3
-rw-r--r--src/defines.h18
6 files changed, 21 insertions, 12 deletions
diff --git a/accountserver.cbp b/accountserver.cbp
index 5c1dc51e..90d14df1 100644
--- a/accountserver.cbp
+++ b/accountserver.cbp
@@ -93,8 +93,6 @@
<Unit filename="src\common\configuration.cpp" />
<Unit filename="src\common\configuration.hpp" />
<Unit filename="src\common\inventorydata.hpp" />
- <Unit filename="src\common\permissionmanager.cpp" />
- <Unit filename="src\common\permissionmanager.hpp" />
<Unit filename="src\common\transaction.hpp" />
<Unit filename="src\dal\dalexcept.h" />
<Unit filename="src\dal\dataprovider.cpp" />
diff --git a/src/Makefile.am b/src/Makefile.am
index f2481bb3..78c7d80f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,8 +39,6 @@ manaserv_account_SOURCES = \
common/configuration.hpp \
common/configuration.cpp \
common/inventorydata.hpp \
- common/permissionmanager.hpp \
- common/permissionmanager.cpp \
dal/dalexcept.h \
dal/dataprovider.h \
dal/dataprovider.cpp \
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index dbd74b07..83a4a8a0 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -29,7 +29,6 @@
#include "account-server/serverhandler.hpp"
#include "chat-server/chathandler.hpp"
#include "common/configuration.hpp"
-#include "common/permissionmanager.hpp"
#include "common/transaction.hpp"
#include "net/connectionhandler.hpp"
#include "net/messagein.hpp"
@@ -235,7 +234,7 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg)
return;
}
- if (PermissionManager::checkPermission(acc->getLevel(), "!play") != PermissionManager::PMR_ALLOWED)
+ if (acc->getLevel() == AL_BANNED)
{
reply.writeByte(LOGIN_BANNED);
client.send(reply);
@@ -390,7 +389,7 @@ void AccountHandler::handleRegisterMessage(AccountClient &client, MessageIn &msg
// we ask for it again when we need it and verify it
// through comparing it with the hash
acc->setEmail(sha256(email));
- acc->setLevel(0x01);
+ acc->setLevel(AL_PLAYER);
// set the date and time of the account registration, and the last login
time_t regdate;
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index 7bc020c8..c547977f 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -36,9 +36,6 @@
#include "utils/xml.hpp"
#include "utils/sha256.h"
-#define AL_BANNED 0x00 // temporary workaround until permission manager support is added
-#define AL_PLAYER 0x01 // temporary workaround until permission manager support is added
-
// TODO: make data/items.xml a constant or read it from config file
static const char *DEFAULT_ITEM_FILE = "data/items.xml";
diff --git a/src/chat-server/chathandler.cpp b/src/chat-server/chathandler.cpp
index 27a9a006..0069eb91 100644
--- a/src/chat-server/chathandler.cpp
+++ b/src/chat-server/chathandler.cpp
@@ -31,7 +31,6 @@
#include "chat-server/chatclient.hpp"
#include "chat-server/chathandler.hpp"
#include "common/transaction.hpp"
-#include "common/permissionmanager.hpp"
#include "net/connectionhandler.hpp"
#include "net/messagein.hpp"
#include "net/messageout.hpp"
@@ -321,7 +320,7 @@ ChatHandler::handleAnnounceMessage(ChatClient &client, MessageIn &msg)
return;
}
- if (PermissionManager::checkPermission(client.accountLevel, "@broadcast") == PermissionManager::PMR_ALLOWED)
+ if (client.accountLevel == AL_ADMIN || client.accountLevel == AL_GM)
{
// TODO: b_lindeijer: Shouldn't announcements also have a sender?
LOG_INFO("ANNOUNCE: " << text);
diff --git a/src/defines.h b/src/defines.h
index ad75a121..6496ee26 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -22,6 +22,24 @@
#define DEFINES_H
/**
+ * Enumeration type for account levels.
+ * A normal player would have permissions of 1
+ * A tester would have permissions of 3 (AL_PLAYER | AL_TESTER)
+ * A dev would have permissions of 7 (AL_PLAYER | AL_TESTER | AL_DEV)
+ * A gm would have permissions of 11 (AL_PLAYER | AL_TESTER | AL_GM)
+ * A admin would have permissions of 255 (*)
+ */
+enum
+{
+ AL_BANNED = 0, /**< This user is currently banned. */
+ AL_PLAYER = 1, /**< User has regular rights. */
+ AL_TESTER = 2, /**< User can perform testing tasks. */
+ AL_DEV = 4, /**< User is a developer and can perform dev tasks */
+ AL_GM = 8, /**< User is a moderator and can perform mod tasks */
+ AL_ADMIN = 128 /**< User can perform administrator tasks. */
+};
+
+/**
* Guild member permissions
* Members with NONE cannot invite users or set permissions
* Members with TOPIC_CHANGE can change the guild channel topic