From b437fa90f07aa03e76b490e52ff8f3f08230894d Mon Sep 17 00:00:00 2001 From: Loudrob Date: Mon, 27 Apr 2015 07:35:09 -0400 Subject: [PATCH] Readd system administrator accessLevel --- otp/ai/MagicWordGlobal.py | 2 +- otp/avatar/DistributedPlayerAI.py | 15 +++++++++++---- toontown/effects/DistributedFireworkShowAI.py | 2 +- toontown/rpc/ToontownRPCHandler.py | 18 +++++++++--------- toontown/rpc/ToontownRPCHandlerBase.py | 2 ++ toontown/toon/DistributedToonAI.py | 9 +++++---- 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/otp/ai/MagicWordGlobal.py b/otp/ai/MagicWordGlobal.py index 8ffee92e..4ea94c53 100644 --- a/otp/ai/MagicWordGlobal.py +++ b/otp/ai/MagicWordGlobal.py @@ -88,10 +88,10 @@ CATEGORY_MODERATOR = MagicWordCategory('Moderator', defaultAccess=300) CATEGORY_CREATIVE = MagicWordCategory('Creative', defaultAccess=400) CATEGORY_PROGRAMMER = MagicWordCategory('Programmer', defaultAccess=500) CATEGORY_ADMINISTRATOR = MagicWordCategory('Administrator', defaultAccess=600) +CATEGORY_SYSTEM_ADMINISTRATOR = MagicWordCategory('System administrator', defaultAccess=700) MINIMUM_MAGICWORD_ACCESS = CATEGORY_COMMUNITY_MANAGER.defaultAccess - class MagicWord: def __init__(self, name, func, types, access, doc): self.name = name diff --git a/otp/avatar/DistributedPlayerAI.py b/otp/avatar/DistributedPlayerAI.py index 8d7eb304..9baf0983 100644 --- a/otp/avatar/DistributedPlayerAI.py +++ b/otp/avatar/DistributedPlayerAI.py @@ -139,7 +139,7 @@ class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.Pl self.friendsList.append((friendId, friendCode)) -@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str]) +@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str]) def system(message): """ Broadcast a to the game server. @@ -151,7 +151,7 @@ def system(message): 10, 1000000, [message]) simbase.air.send(dg) -@magicWord(category=CATEGORY_ADMINISTRATOR, types=[int]) +@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[int]) def maintenance(minutes): """ Initiate the maintenance message sequence. It will last for the specified @@ -187,7 +187,7 @@ def maintenance(minutes): countdown(minutes) -@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str, str, int]) +@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str, str, int]) def accessLevel(accessLevel, storage='PERSISTENT', showGM=1): """ Modify the target's access level. @@ -209,7 +209,14 @@ def accessLevel(accessLevel, storage='PERSISTENT', showGM=1): 'p': CATEGORY_PROGRAMMER.defaultAccess, 'administrator': CATEGORY_ADMINISTRATOR.defaultAccess, 'admin': CATEGORY_ADMINISTRATOR.defaultAccess, - 'a': CATEGORY_ADMINISTRATOR.defaultAccess + 'a': CATEGORY_ADMINISTRATOR.defaultAccess, + 'systemadministrator': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 'systemadmin': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 'sysadministrator': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 'sysadmin': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 'system': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 'sys': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess, + 's': CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess } try: accessLevel = int(accessLevel) diff --git a/toontown/effects/DistributedFireworkShowAI.py b/toontown/effects/DistributedFireworkShowAI.py index a4905ae5..8523667e 100644 --- a/toontown/effects/DistributedFireworkShowAI.py +++ b/toontown/effects/DistributedFireworkShowAI.py @@ -36,7 +36,7 @@ class DistributedFireworkShowAI(DistributedObjectAI): pass -@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str]) +@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str]) def fireworks(showName='july4'): """ Starts a fireworks show on the AI server. diff --git a/toontown/rpc/ToontownRPCHandler.py b/toontown/rpc/ToontownRPCHandler.py index 81778c6a..54d8c6e8 100644 --- a/toontown/rpc/ToontownRPCHandler.py +++ b/toontown/rpc/ToontownRPCHandler.py @@ -37,7 +37,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): # --- GENERAL --- - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_queryObject(self, doId): """ Summary: @@ -69,7 +69,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): return result - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_updateObject(self, doId, dclassName, newFields, oldFields=None): """ Summary: @@ -119,7 +119,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): return result[0] - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_setField(self, doId, dclassName, fieldName, args=[]): """ Summary: @@ -152,7 +152,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): # --- MESSAGES --- - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_messageChannel(self, channel, message): """ Summary: @@ -169,7 +169,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): channel, 1000000, [message]) self.air.send(datagram) - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_messageAll(self, message): """ Summary: Broadcasts a [message] to all clients. @@ -179,7 +179,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): """ self.rpc_messageChannel(10, message) - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_messageShard(self, shardId, message): """ Summary: @@ -254,7 +254,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): # --- KICKS --- - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_kickChannel(self, channel, code, reason): """ Summary: @@ -272,7 +272,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): datagram.addString(reason) self.air.send(datagram) - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_kickAll(self, code, reason): """ Summary: Kicks all clients. @@ -283,7 +283,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): """ self.rpc_kickChannel(10, code, reason) - @rpcmethod(accessLevel=ADMINISTRATOR) + @rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) def rpc_kickShard(self, shardId, code, reason): """ Summary: Kicks all clients under the provided [shardId]. diff --git a/toontown/rpc/ToontownRPCHandlerBase.py b/toontown/rpc/ToontownRPCHandlerBase.py index ee7a56a8..dbf2ab7c 100644 --- a/toontown/rpc/ToontownRPCHandlerBase.py +++ b/toontown/rpc/ToontownRPCHandlerBase.py @@ -13,6 +13,8 @@ MODERATOR = 300 ARTIST = 400 PROGRAMMER = 500 ADMINISTRATOR = 600 +SYSTEM_ADMINISTRATOR = 700 + class RPCMethod: def __init__(self, accessLevel=UNKNOWN): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 7f13a707..8ae37099 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -4651,7 +4651,7 @@ def gmIcon(accessLevel=None): invoker = spellbook.getInvoker() target = spellbook.getTarget() invokerAccess = spellbook.getInvokerAccess() - if invokerAccess != CATEGORY_ADMINISTRATOR.defaultAccess: + if invokerAccess != CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess: if accessLevel is not None: return "You must be of a higher access level to override your GM icon." target = spellbook.getInvoker() @@ -4666,14 +4666,15 @@ def gmIcon(accessLevel=None): if accessLevel is None: accessLevel = target.getAdminAccess() if accessLevel != target.getGMType(): - if invokerAccess != CATEGORY_ADMINISTRATOR.defaultAccess: + if invokerAccess != CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess: accessLevel = target.getGMType() if accessLevel not in (0, CATEGORY_COMMUNITY_MANAGER.defaultAccess, CATEGORY_MODERATOR.defaultAccess, CATEGORY_CREATIVE.defaultAccess, CATEGORY_PROGRAMMER.defaultAccess, - CATEGORY_ADMINISTRATOR.defaultAccess): + CATEGORY_ADMINISTRATOR.defaultAccess, + CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess): return 'Invalid access level!' target.b_setGM(accessLevel) if accessLevel == target.getAdminAccess(): @@ -5179,4 +5180,4 @@ def emblems(silver=10, gold=10): @magicWord(category=CATEGORY_PROGRAMMER) def catalog(): - simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget()) \ No newline at end of file + simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget())