mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Readd system administrator accessLevel
This commit is contained in:
parent
52553e5bf9
commit
b437fa90f0
6 changed files with 29 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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 <message> 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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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].
|
||||
|
|
|
@ -13,6 +13,8 @@ MODERATOR = 300
|
|||
ARTIST = 400
|
||||
PROGRAMMER = 500
|
||||
ADMINISTRATOR = 600
|
||||
SYSTEM_ADMINISTRATOR = 700
|
||||
|
||||
|
||||
class RPCMethod:
|
||||
def __init__(self, accessLevel=UNKNOWN):
|
||||
|
|
|
@ -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())
|
||||
simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget())
|
||||
|
|
Loading…
Reference in a new issue