Merge branch 'master' into develop

This commit is contained in:
Griatch 2018-10-26 20:52:44 +02:00
commit 686d80f5d9
5 changed files with 58 additions and 6 deletions

View file

@ -3097,7 +3097,8 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
return
# we have a prototype, check access
prototype = prototypes[0]
if not caller.locks.check_lockstring(caller, prototype.get('prototype_locks', ''), access_type='spawn'):
if not caller.locks.check_lockstring(
caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True):
caller.msg("You don't have access to use this prototype.")
return

View file

@ -0,0 +1,15 @@
This directory contains Evennia's log files. The existence of this README.md file is also necessary
to correctly include the log directory in git (since log files are ignored by git and you can't
commit an empty directory).
- `server.log` - log file from the game Server.
- `portal.log` - log file from Portal proxy (internet facing)
Usually these logs are viewed together with `evennia -l`. They are also rotated every week so as not
to be too big. Older log names will have a name appended by `_month_date`.
- `lockwarnings.log` - warnings from the lock system.
- `http_requests.log` - this will generally be empty unless turning on debugging inside the server.
- `channel_<channelname>.log` - these are channel logs for the in-game channels They are also used
by the `/history` flag in-game to get the latest message history.

View file

@ -258,7 +258,7 @@ def delete_prototype(prototype_key, caller=None):
stored_prototype = stored_prototype[0]
if caller:
if not stored_prototype.access(caller, 'edit'):
raise PermissionError("{} does not have permission to "
raise PermissionError("{} needs explicit 'edit' permissions to "
"delete prototype {}.".format(caller, prototype_key))
stored_prototype.delete()
return True
@ -374,14 +374,14 @@ def list_prototypes(caller, key=None, tags=None, show_non_use=False, show_non_ed
display_tuples = []
for prototype in sorted(prototypes, key=lambda d: d.get('prototype_key', '')):
lock_use = caller.locks.check_lockstring(
caller, prototype.get('prototype_locks', ''), access_type='spawn')
caller, prototype.get('prototype_locks', ''), access_type='spawn', default=True)
if not show_non_use and not lock_use:
continue
if prototype.get('prototype_key', '') in _MODULE_PROTOTYPES:
lock_edit = False
else:
lock_edit = caller.locks.check_lockstring(
caller, prototype.get('prototype_locks', ''), access_type='edit')
caller, prototype.get('prototype_locks', ''), access_type='edit', default=True)
if not show_non_edit and not lock_edit:
continue
ptags = []
@ -713,7 +713,8 @@ def check_permission(prototype_key, action, default=True):
lockstring = prototype.get("prototype_locks")
if lockstring:
return check_lockstring(None, lockstring, default=default, access_type=action)
return check_lockstring(None, lockstring,
default=default, access_type=action)
return default

View file

@ -222,6 +222,19 @@ RECREATED_SETTINGS = \
their accounts with their old passwords.
"""
ERROR_INITMISSING = \
"""
ERROR: 'evennia --initmissing' must be called from the root of
your game directory, since it tries to create any missing files
in the server/ subfolder.
"""
RECREATED_MISSING = \
"""
(Re)created any missing directories or files. Evennia should
be ready to run now!
"""
ERROR_DATABASE = \
"""
ERROR: Your database does not seem to be set up correctly.
@ -1331,7 +1344,10 @@ def create_settings_file(init=True, secret_settings=False):
else:
print("Reset the settings file.")
default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "settings.py")
if secret_settings:
default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "secret_settings.py")
else:
default_settings_path = os.path.join(EVENNIA_TEMPLATE, "server", "conf", "settings.py")
shutil.copy(default_settings_path, settings_path)
with open(settings_path, 'r') as f:
@ -1914,6 +1930,10 @@ def main():
'--initsettings', action='store_true', dest="initsettings",
default=False,
help="create a new, empty settings file as\n gamedir/server/conf/settings.py")
parser.add_argument(
'--initmissing', action='store_true', dest="initmissing",
default=False,
help="checks for missing secret_settings or server logs\n directory, and adds them if needed")
parser.add_argument(
'--profiler', action='store_true', dest='profiler', default=False,
help="start given server component under the Python profiler")
@ -1987,6 +2007,21 @@ def main():
print(ERROR_INITSETTINGS)
sys.exit()
if args.initmissing:
try:
log_path = os.path.join(SERVERDIR, "logs")
if not os.path.exists(log_path):
os.makedirs(log_path)
settings_path = os.path.join(CONFDIR, "secret_settings.py")
if not os.path.exists(settings_path):
create_settings_file(init=False, secret_settings=True)
print(RECREATED_MISSING)
except IOError:
print(ERROR_INITMISSING)
sys.exit()
if args.tail_log:
# set up for tailing the log files
global NO_REACTOR_STOP