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 authored and Gina Häußge committed 2015-12-16 11:59:45 +01:00
1 parent 54f24b43f0
commit ccd2ddc056
2 files changed
+2 -2

No files matched your search

+1 -1
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:
+1 -1
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)