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_CREATIVE = MagicWordCategory('Creative', defaultAccess=400)
|
||||||
CATEGORY_PROGRAMMER = MagicWordCategory('Programmer', defaultAccess=500)
|
CATEGORY_PROGRAMMER = MagicWordCategory('Programmer', defaultAccess=500)
|
||||||
CATEGORY_ADMINISTRATOR = MagicWordCategory('Administrator', defaultAccess=600)
|
CATEGORY_ADMINISTRATOR = MagicWordCategory('Administrator', defaultAccess=600)
|
||||||
|
CATEGORY_SYSTEM_ADMINISTRATOR = MagicWordCategory('System administrator', defaultAccess=700)
|
||||||
|
|
||||||
MINIMUM_MAGICWORD_ACCESS = CATEGORY_COMMUNITY_MANAGER.defaultAccess
|
MINIMUM_MAGICWORD_ACCESS = CATEGORY_COMMUNITY_MANAGER.defaultAccess
|
||||||
|
|
||||||
|
|
||||||
class MagicWord:
|
class MagicWord:
|
||||||
def __init__(self, name, func, types, access, doc):
|
def __init__(self, name, func, types, access, doc):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
@ -139,7 +139,7 @@ class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.Pl
|
||||||
self.friendsList.append((friendId, friendCode))
|
self.friendsList.append((friendId, friendCode))
|
||||||
|
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str])
|
@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str])
|
||||||
def system(message):
|
def system(message):
|
||||||
"""
|
"""
|
||||||
Broadcast a <message> to the game server.
|
Broadcast a <message> to the game server.
|
||||||
|
@ -151,7 +151,7 @@ def system(message):
|
||||||
10, 1000000, [message])
|
10, 1000000, [message])
|
||||||
simbase.air.send(dg)
|
simbase.air.send(dg)
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_ADMINISTRATOR, types=[int])
|
@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[int])
|
||||||
def maintenance(minutes):
|
def maintenance(minutes):
|
||||||
"""
|
"""
|
||||||
Initiate the maintenance message sequence. It will last for the specified
|
Initiate the maintenance message sequence. It will last for the specified
|
||||||
|
@ -187,7 +187,7 @@ def maintenance(minutes):
|
||||||
|
|
||||||
countdown(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):
|
def accessLevel(accessLevel, storage='PERSISTENT', showGM=1):
|
||||||
"""
|
"""
|
||||||
Modify the target's access level.
|
Modify the target's access level.
|
||||||
|
@ -209,7 +209,14 @@ def accessLevel(accessLevel, storage='PERSISTENT', showGM=1):
|
||||||
'p': CATEGORY_PROGRAMMER.defaultAccess,
|
'p': CATEGORY_PROGRAMMER.defaultAccess,
|
||||||
'administrator': CATEGORY_ADMINISTRATOR.defaultAccess,
|
'administrator': CATEGORY_ADMINISTRATOR.defaultAccess,
|
||||||
'admin': 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:
|
try:
|
||||||
accessLevel = int(accessLevel)
|
accessLevel = int(accessLevel)
|
||||||
|
|
|
@ -36,7 +36,7 @@ class DistributedFireworkShowAI(DistributedObjectAI):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str])
|
@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str])
|
||||||
def fireworks(showName='july4'):
|
def fireworks(showName='july4'):
|
||||||
"""
|
"""
|
||||||
Starts a fireworks show on the AI server.
|
Starts a fireworks show on the AI server.
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
|
|
||||||
# --- GENERAL ---
|
# --- GENERAL ---
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_queryObject(self, doId):
|
def rpc_queryObject(self, doId):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -69,7 +69,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_updateObject(self, doId, dclassName, newFields, oldFields=None):
|
def rpc_updateObject(self, doId, dclassName, newFields, oldFields=None):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -119,7 +119,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
|
|
||||||
return result[0]
|
return result[0]
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_setField(self, doId, dclassName, fieldName, args=[]):
|
def rpc_setField(self, doId, dclassName, fieldName, args=[]):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -152,7 +152,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
|
|
||||||
# --- MESSAGES ---
|
# --- MESSAGES ---
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_messageChannel(self, channel, message):
|
def rpc_messageChannel(self, channel, message):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -169,7 +169,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
channel, 1000000, [message])
|
channel, 1000000, [message])
|
||||||
self.air.send(datagram)
|
self.air.send(datagram)
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_messageAll(self, message):
|
def rpc_messageAll(self, message):
|
||||||
"""
|
"""
|
||||||
Summary: Broadcasts a [message] to all clients.
|
Summary: Broadcasts a [message] to all clients.
|
||||||
|
@ -179,7 +179,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
"""
|
"""
|
||||||
self.rpc_messageChannel(10, message)
|
self.rpc_messageChannel(10, message)
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_messageShard(self, shardId, message):
|
def rpc_messageShard(self, shardId, message):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -254,7 +254,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
|
|
||||||
# --- KICKS ---
|
# --- KICKS ---
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_kickChannel(self, channel, code, reason):
|
def rpc_kickChannel(self, channel, code, reason):
|
||||||
"""
|
"""
|
||||||
Summary:
|
Summary:
|
||||||
|
@ -272,7 +272,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
datagram.addString(reason)
|
datagram.addString(reason)
|
||||||
self.air.send(datagram)
|
self.air.send(datagram)
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_kickAll(self, code, reason):
|
def rpc_kickAll(self, code, reason):
|
||||||
"""
|
"""
|
||||||
Summary: Kicks all clients.
|
Summary: Kicks all clients.
|
||||||
|
@ -283,7 +283,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
|
||||||
"""
|
"""
|
||||||
self.rpc_kickChannel(10, code, reason)
|
self.rpc_kickChannel(10, code, reason)
|
||||||
|
|
||||||
@rpcmethod(accessLevel=ADMINISTRATOR)
|
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR)
|
||||||
def rpc_kickShard(self, shardId, code, reason):
|
def rpc_kickShard(self, shardId, code, reason):
|
||||||
"""
|
"""
|
||||||
Summary: Kicks all clients under the provided [shardId].
|
Summary: Kicks all clients under the provided [shardId].
|
||||||
|
|
|
@ -13,6 +13,8 @@ MODERATOR = 300
|
||||||
ARTIST = 400
|
ARTIST = 400
|
||||||
PROGRAMMER = 500
|
PROGRAMMER = 500
|
||||||
ADMINISTRATOR = 600
|
ADMINISTRATOR = 600
|
||||||
|
SYSTEM_ADMINISTRATOR = 700
|
||||||
|
|
||||||
|
|
||||||
class RPCMethod:
|
class RPCMethod:
|
||||||
def __init__(self, accessLevel=UNKNOWN):
|
def __init__(self, accessLevel=UNKNOWN):
|
||||||
|
|
|
@ -4651,7 +4651,7 @@ def gmIcon(accessLevel=None):
|
||||||
invoker = spellbook.getInvoker()
|
invoker = spellbook.getInvoker()
|
||||||
target = spellbook.getTarget()
|
target = spellbook.getTarget()
|
||||||
invokerAccess = spellbook.getInvokerAccess()
|
invokerAccess = spellbook.getInvokerAccess()
|
||||||
if invokerAccess != CATEGORY_ADMINISTRATOR.defaultAccess:
|
if invokerAccess != CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess:
|
||||||
if accessLevel is not None:
|
if accessLevel is not None:
|
||||||
return "You must be of a higher access level to override your GM icon."
|
return "You must be of a higher access level to override your GM icon."
|
||||||
target = spellbook.getInvoker()
|
target = spellbook.getInvoker()
|
||||||
|
@ -4666,14 +4666,15 @@ def gmIcon(accessLevel=None):
|
||||||
if accessLevel is None:
|
if accessLevel is None:
|
||||||
accessLevel = target.getAdminAccess()
|
accessLevel = target.getAdminAccess()
|
||||||
if accessLevel != target.getGMType():
|
if accessLevel != target.getGMType():
|
||||||
if invokerAccess != CATEGORY_ADMINISTRATOR.defaultAccess:
|
if invokerAccess != CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess:
|
||||||
accessLevel = target.getGMType()
|
accessLevel = target.getGMType()
|
||||||
if accessLevel not in (0,
|
if accessLevel not in (0,
|
||||||
CATEGORY_COMMUNITY_MANAGER.defaultAccess,
|
CATEGORY_COMMUNITY_MANAGER.defaultAccess,
|
||||||
CATEGORY_MODERATOR.defaultAccess,
|
CATEGORY_MODERATOR.defaultAccess,
|
||||||
CATEGORY_CREATIVE.defaultAccess,
|
CATEGORY_CREATIVE.defaultAccess,
|
||||||
CATEGORY_PROGRAMMER.defaultAccess,
|
CATEGORY_PROGRAMMER.defaultAccess,
|
||||||
CATEGORY_ADMINISTRATOR.defaultAccess):
|
CATEGORY_ADMINISTRATOR.defaultAccess,
|
||||||
|
CATEGORY_SYSTEM_ADMINISTRATOR.defaultAccess):
|
||||||
return 'Invalid access level!'
|
return 'Invalid access level!'
|
||||||
target.b_setGM(accessLevel)
|
target.b_setGM(accessLevel)
|
||||||
if accessLevel == target.getAdminAccess():
|
if accessLevel == target.getAdminAccess():
|
||||||
|
@ -5179,4 +5180,4 @@ def emblems(silver=10, gold=10):
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER)
|
@magicWord(category=CATEGORY_PROGRAMMER)
|
||||||
def catalog():
|
def catalog():
|
||||||
simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget())
|
simbase.air.catalogManager.deliverCatalogFor(spellbook.getTarget())
|
||||||
|
|
Loading…
Reference in a new issue