Remove access level 700

This commit is contained in:
DenialMC 2015-04-26 19:06:49 +03:00
parent 162aa11a09
commit 4a1ac56d02
8 changed files with 16 additions and 74 deletions

View file

@ -1,43 +0,0 @@
from direct.showbase.DirectObject import DirectObject
from direct.showbase import GarbageReport
class GarbageLeakServerEventAggregator(DirectObject):
def __init__(self, cr):
self.cr = cr
self._doLaterName = None
self._sentLeakDesc2num = {}
self._curLeakDesc2num = {}
self.accept(GarbageReport.GarbageCycleCountAnnounceEvent, self._handleCycleCounts)
return
def destroy(self):
self._stopSending()
self.ignoreAll()
del self.cr
def _handleCycleCounts(self, desc2num):
self._curLeakDesc2num = desc2num
self._startSending()
def _startSending(self):
if not self._doLaterName:
self._sendLeaks()
self._doLaterName = uniqueName('%s-sendGarbageLeakInfo' % self.__class__.__name__)
self.doMethodLater(60 * 60.0, self._sendLeaks, self._doLaterName)
def _stopSending(self):
if self._doLaterName:
self.removeTask(self._doLaterName)
self._doLaterName = None
return
def _sendLeaks(self, task = None):
for desc, curNum in self._curLeakDesc2num.iteritems():
self._sentLeakDesc2num.setdefault(desc, 0)
num = curNum - self._sentLeakDesc2num[desc]
if num > 0:
self._sentLeakDesc2num[desc] = curNum
if task:
return task.again

View file

@ -88,7 +88,6 @@ 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

View file

@ -139,7 +139,7 @@ class DistributedPlayerAI(DistributedAvatarAI.DistributedAvatarAI, PlayerBase.Pl
self.friendsList.append((friendId, friendCode)) self.friendsList.append((friendId, friendCode))
@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str]) @magicWord(category=CATEGORY_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_SYSTEM_ADMINISTRATOR, types=[int]) @magicWord(category=CATEGORY_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
@ -209,14 +209,7 @@ 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)

View file

@ -23,7 +23,6 @@ import sys
import time import time
import types import types
from otp.ai.GarbageLeakServerEventAggregator import GarbageLeakServerEventAggregator
from otp.avatar import Avatar from otp.avatar import Avatar
from otp.avatar import DistributedAvatar from otp.avatar import DistributedAvatar
from otp.avatar.DistributedPlayer import DistributedPlayer from otp.avatar.DistributedPlayer import DistributedPlayer
@ -1168,7 +1167,6 @@ class OTPClientRepository(ClientRepositoryBase):
if self.music: if self.music:
self.music.stop() self.music.stop()
self.music = None self.music = None
self.garbageLeakLogger = GarbageLeakServerEventAggregator(self)
self.handler = self.handlePlayGame self.handler = self.handlePlayGame
self.accept(self.gameDoneEvent, self.handleGameDone) self.accept(self.gameDoneEvent, self.handleGameDone)
base.transitions.noFade() base.transitions.noFade()
@ -1208,8 +1206,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.playGame.exit() self.playGame.exit()
self.playGame.unload() self.playGame.unload()
self.ignore(self.gameDoneEvent) self.ignore(self.gameDoneEvent)
self.garbageLeakLogger.destroy()
del self.garbageLeakLogger
return return
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')

View file

@ -36,7 +36,7 @@ class DistributedFireworkShowAI(DistributedObjectAI):
pass pass
@magicWord(category=CATEGORY_SYSTEM_ADMINISTRATOR, types=[str]) @magicWord(category=CATEGORY_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.

View file

@ -37,7 +37,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
# --- GENERAL --- # --- GENERAL ---
@rpcmethod(accessLevel=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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=SYSTEM_ADMINISTRATOR) @rpcmethod(accessLevel=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].

View file

@ -13,8 +13,6 @@ 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):

View file

@ -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_SYSTEM_ADMINISTRATOR.defaultAccess: if invokerAccess != CATEGORY_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,15 +4666,14 @@ 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_SYSTEM_ADMINISTRATOR.defaultAccess: if invokerAccess != CATEGORY_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():