diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index ac2c3fa6..b4d862ae 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -8,6 +8,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms import logging from flask import request, jsonify, make_response +from flask.ext.login import current_user from werkzeug.exceptions import BadRequest from octoprint.events import eventManager, Events @@ -30,11 +31,18 @@ def _etag(lm=None): lm = _lastmodified() connection_options = printer.__class__.get_connection_options() + plugins = sorted(octoprint.plugin.plugin_manager().enabled_plugins) + if current_user is not None and not current_user.is_anonymous(): + roles = sorted(current_user.roles) + else: + roles = [] import hashlib hash = hashlib.sha1() hash.update(str(lm)) hash.update(repr(connection_options)) + hash.update(repr(plugins)) + hash.update(repr(roles)) return hash.hexdigest() @api.route("/settings", methods=["GET"]) diff --git a/src/octoprint/users.py b/src/octoprint/users.py index a615d222..0147329e 100644 --- a/src/octoprint/users.py +++ b/src/octoprint/users.py @@ -464,6 +464,10 @@ class User(UserMixin): return self._get_setting(path) + @property + def roles(self): + return list(self._roles) + def set_setting(self, key, value): if not isinstance(key, (tuple, list)): path = [key]