Fixed a bug with access control during first run

Requests against restricted resources could fail even though the
first run wizard had been completed successfully.
This commit is contained in:
Salandora 2015-12-15 18:04:52 +01:00 committed by Gina Häußge
parent 54f24b43f0
commit ccd2ddc056
2 changed files with 2 additions and 2 deletions

View file

@ -101,7 +101,7 @@ def load_user(id):
else:
sessionid = None
if userManager is not None:
if settings().getBoolean(["accessControl", "enabled"]) and userManager is not None:
if sessionid:
return userManager.findUser(userid=id, session=sessionid)
else:

View file

@ -700,7 +700,7 @@ def restricted_access(func):
@functools.wraps(func)
def decorated_view(*args, **kwargs):
# if OctoPrint hasn't been set up yet, abort
if settings().getBoolean(["server", "firstRun"]) and (octoprint.server.userManager is None or not octoprint.server.userManager.hasBeenCustomized()):
if settings().getBoolean(["server", "firstRun"]) and settings().getBoolean(["accessControl", "enabled"]) and (octoprint.server.userManager is None or not octoprint.server.userManager.hasBeenCustomized()):
return flask.make_response("OctoPrint isn't setup yet", 403)
apikey = octoprint.server.util.get_api_key(flask.request)