summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 5c1dc51..90d14df 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 f2481bb..78c7d80 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 dbd74b0..83a4a8a 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 7bc020c..c547977 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 27a9a00..0069eb9 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 ad75a12..6496ee2 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