Fix bug, set no-idle locks on bots
This commit is contained in:
parent
72e3498785
commit
ea87eef218
3 changed files with 14 additions and 15 deletions
|
|
@ -565,8 +565,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
"""
|
"""
|
||||||
# A basic security setup
|
# A basic security setup
|
||||||
lockstring = "examine:perm(Admin);edit:perm(Admin);" \
|
lockstring = "examine:perm(Admin);edit:perm(Admin);" \
|
||||||
"delete:perm(Admin);boot:perm(Admin);msg:all();" \
|
"delete:perm(Admin);boot:perm(Admin);msg:all()"
|
||||||
"noidletimeout:perm(Builder) or perm(noidletimeout)"
|
|
||||||
self.locks.add(lockstring)
|
self.locks.add(lockstring)
|
||||||
|
|
||||||
# The ooc account cmdset
|
# The ooc account cmdset
|
||||||
|
|
@ -582,7 +581,8 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
"""
|
"""
|
||||||
# set an (empty) attribute holding the characters this account has
|
# set an (empty) attribute holding the characters this account has
|
||||||
lockstring = "attrread:perm(Admins);attredit:perm(Admins);" \
|
lockstring = "attrread:perm(Admins);attredit:perm(Admins);" \
|
||||||
"attrcreate:perm(Admins)"
|
"attrcreate:perm(Admins);" \
|
||||||
|
"noidletimeout:perm(Builder) or perm(noidletimeout)"
|
||||||
self.attributes.add("_playable_characters", [], lockstring=lockstring)
|
self.attributes.add("_playable_characters", [], lockstring=lockstring)
|
||||||
self.attributes.add("_saved_protocol_flags", {}, lockstring=lockstring)
|
self.attributes.add("_saved_protocol_flags", {}, lockstring=lockstring)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,6 @@ class BotStarter(DefaultScript):
|
||||||
self.desc = "bot start/keepalive"
|
self.desc = "bot start/keepalive"
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
self.db.started = False
|
self.db.started = False
|
||||||
if _IDLE_TIMEOUT > 0:
|
|
||||||
# call before idle_timeout triggers
|
|
||||||
self.interval = int(max(60, _IDLE_TIMEOUT * 0.90))
|
|
||||||
self.start_delay = True
|
|
||||||
|
|
||||||
def at_start(self):
|
def at_start(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -101,8 +97,9 @@ class Bot(DefaultAccount):
|
||||||
"""
|
"""
|
||||||
# the text encoding to use.
|
# the text encoding to use.
|
||||||
self.db.encoding = "utf-8"
|
self.db.encoding = "utf-8"
|
||||||
# A basic security setup
|
# A basic security setup (also avoid idle disconnects)
|
||||||
lockstring = "examine:perm(Admin);edit:perm(Admin);delete:perm(Admin);boot:perm(Admin);msg:false()"
|
lockstring = "examine:perm(Admin);edit:perm(Admin);delete:perm(Admin);" \
|
||||||
|
"boot:perm(Admin);msg:false();noidletimeout:true()"
|
||||||
self.locks.add(lockstring)
|
self.locks.add(lockstring)
|
||||||
# set the basics of being a bot
|
# set the basics of being a bot
|
||||||
script_key = "%s" % self.key
|
script_key = "%s" % self.key
|
||||||
|
|
|
||||||
|
|
@ -1779,6 +1779,7 @@ class CmdLock(ObjManipCommand):
|
||||||
if '/' in self.lhs:
|
if '/' in self.lhs:
|
||||||
# call on the form @lock obj/access_type
|
# call on the form @lock obj/access_type
|
||||||
objname, access_type = [p.strip() for p in self.lhs.split('/', 1)]
|
objname, access_type = [p.strip() for p in self.lhs.split('/', 1)]
|
||||||
|
obj = None
|
||||||
if objname.startswith("*"):
|
if objname.startswith("*"):
|
||||||
obj = caller.search_account(objname.lstrip('*'))
|
obj = caller.search_account(objname.lstrip('*'))
|
||||||
if not obj:
|
if not obj:
|
||||||
|
|
@ -1811,6 +1812,7 @@ class CmdLock(ObjManipCommand):
|
||||||
return
|
return
|
||||||
|
|
||||||
objname, lockdef = self.lhs, self.rhs
|
objname, lockdef = self.lhs, self.rhs
|
||||||
|
obj = None
|
||||||
if objname.startswith("*"):
|
if objname.startswith("*"):
|
||||||
obj = caller.search_account(objname.lstrip('*'))
|
obj = caller.search_account(objname.lstrip('*'))
|
||||||
if not obj:
|
if not obj:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue