diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f4b8065..6801292f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -555,7 +555,7 @@ You can find out more about the change, how to know if a plugin is even affected * Make timeout after which to unload the webcam stream after navigating away from it configurable (as suggested in [#1937](https://github.com/foosel/OctoPrint/issues/1937)) * Add `ToolChange` event and tool change GCODE scripts * Support parsing GCODE subcodes. - * Add `octoprint.users.factory` hook, allowing plugins to extend/swap out the user manager OctoPrint uses. + * Add `octoprint.access.users.factory` hook, allowing plugins to extend/swap out the user manager OctoPrint uses. * Corewizard: Disable view model and client code if it's not actually required. * Corewizard: Disable injection of JS files into UI when it's not actually required. * GCODE analysis: Moved into its own subprocess. That should improve performance on multi core systems. diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index c50bc58e5..0cc0b892f 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -29,7 +29,7 @@ Use the following settings to enable access control: # The user manager implementation to use for accessing user information. Currently only a filebased # user manager is implemented which stores configured accounts in a YAML file (Default: users.yaml # in the default configuration folder, see below) - userManager: octoprint.users.FilebasedUserManager + userManager: octoprint.access.users.FilebasedUserManager # The YAML user file to use. If left out defaults to users.yaml in the default configuration folder. userFile: /path/to/users.yaml diff --git a/docs/modules/users.rst b/docs/modules/users.rst index f147a46a3..732059f62 100644 --- a/docs/modules/users.rst +++ b/docs/modules/users.rst @@ -1,9 +1,9 @@ .. _sec-modules-users: -octoprint.users +octoprint.access.users --------------- -.. automodule:: octoprint.users +.. automodule:: octoprint.access.users :members: diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index e40d2c28f..a6c85e40d 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -241,7 +241,7 @@ octoprint.accesscontrol.keyvalidator ``apikey`` will be the API key as read from the request headers. - Hook handlers are expected to return a :class:`~octoprint.users.User` instance here that will then be considered that + Hook handlers are expected to return a :class:`~octoprint.access.users.User` instance here that will then be considered that user making the request. By returning ``None`` or nothing at all, hook handlers signal that they do not handle the provided key. @@ -259,7 +259,7 @@ octoprint.accesscontrol.keyvalidator :param str apikey: The API key to validate :return: The user in whose name the request will be processed further - :rtype: :class:`~octoprint.users.User` + :rtype: :class:`~octoprint.access.users.User` .. _sec-plugins-hook-cli-commands: @@ -1063,7 +1063,7 @@ octoprint.printer.factory * ``file_manager``: The :class:`~octoprint.filemanager.FileManager` * ``app_session_manager``: The :class:`~octoprint.server.util.flask.AppSessionManager` * ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager` - * ``user_manager``: The :class:`~octoprint.users.UserManager` + * ``user_manager``: The :class:`~octoprint.access.users.UserManager` * ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache` If the factory returns anything but ``None``, it will be assigned to the global ``printer`` instance. @@ -1549,12 +1549,12 @@ octoprint.ui.web.templatetypes .. _sec-plugins-hook-users-factory: -octoprint.users.factory -~~~~~~~~~~~~~~~~~~~~~~~ +octoprint.access.users.factory +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs) - Return a :class:`~octoprint.users.UserManager` instance to use as global user manager object. This will + Return a :class:`~octoprint.access.users.UserManager` instance to use as global user manager object. This will be called only once during initial server startup. The provided ``components`` is a dictionary containing the already initialized system components: @@ -1573,7 +1573,7 @@ octoprint.users.factory If none of the registered factories return a user manager instance, the class referenced by the ``config.yaml`` entry ``accessControl.userManager`` will be initialized if possible, otherwise a stock - :class:`~octoprint.users.FilebasedUserManager` will be instantiated, linked to the default user storage + :class:`~octoprint.access.users.FilebasedUserManager` will be instantiated, linked to the default user storage file ``~/.octoprint/users.yaml``. :param dict components: System components to use for user manager instance initialization diff --git a/docs/plugins/injectedproperties.rst b/docs/plugins/injectedproperties.rst index 7b4bf311a..046079fcc 100644 --- a/docs/plugins/injectedproperties.rst +++ b/docs/plugins/injectedproperties.rst @@ -44,7 +44,7 @@ An overview of these properties follows. ``self._app_session_manager`` OctoPrint's application session manager, an instance of :class:`octoprint.server.util.flask.AppSessionManager`. ``self._user_manager`` - OctoPrint's user manager, an instance of :class:`octoprint.users.UserManager`. + OctoPrint's user manager, an instance of :class:`octoprint.access.users.UserManager`. ``self._connectivity_checker`` OctoPrint's connectivity checker, an instance of :class:`octoprint.util.ConnectivityChecker`. diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index 1bd9991f0..c20d2ab5b 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -66,7 +66,7 @@ class OctoPrintPlugin(Plugin): .. attribute:: _app_session_manager - The :class:`~octoprint.users.SessionManager` instance. Injected by the plugin core system upon initialization of + The :class:`~octoprint.access.users.SessionManager` instance. Injected by the plugin core system upon initialization of the implementation. .. attribute:: _plugin_lifecycle_manager @@ -76,7 +76,7 @@ class OctoPrintPlugin(Plugin): .. attribute:: _user_manager - The :class:`~octoprint.users.UserManager` instance. Injected by the plugin core system upon initialization + The :class:`~octoprint.access.users.UserManager` instance. Injected by the plugin core system upon initialization of the implementation. .. attribute:: _connectivity_checker diff --git a/src/octoprint/plugins/corewizard/subwizards.py b/src/octoprint/plugins/corewizard/subwizards.py index 5cc7fb6eb..bf3123cea 100644 --- a/src/octoprint/plugins/corewizard/subwizards.py +++ b/src/octoprint/plugins/corewizard/subwizards.py @@ -91,8 +91,8 @@ class AclSubwizard(object): # disable access control self._settings.global_set_boolean(["accessControl", "enabled"], False) - octoprint.server.loginManager.anonymous_user = octoprint.users.DummyUser - octoprint.server.principals.identity_loaders.appendleft(octoprint.users.dummy_identity_loader) + octoprint.server.loginManager.anonymous_user = octoprint.access.users.DummyUser + octoprint.server.principals.identity_loaders.appendleft(octoprint.access.users.dummy_identity_loader) self._user_manager.disable() self._settings.save() diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index d34d4a587..2f40981c8 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -398,7 +398,7 @@ class Server(object): components.update(dict(group_manager=groupManager)) # create user manager instance - user_manager_factories = pluginManager.get_hooks("octoprint.users.factory") # legacy, set first so that new wins + user_manager_factories = pluginManager.get_hooks("octoprint.access.users.factory") # legacy, set first so that new wins user_manager_factories.update(pluginManager.get_hooks("octoprint.access.users.factory")) for name, factory in user_manager_factories.items(): try: diff --git a/tests/access/users/test_usermanager.py b/tests/access/users/test_usermanager.py index 5b1dc9d4f..8f16674d0 100644 --- a/tests/access/users/test_usermanager.py +++ b/tests/access/users/test_usermanager.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function """ -Unit tests for octoprint.users.UserManager +Unit tests for octoprint.access.users.UserManager """ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' diff --git a/tests/access/users/test_users.py b/tests/access/users/test_users.py index 12c0c9d57..42b181316 100644 --- a/tests/access/users/test_users.py +++ b/tests/access/users/test_users.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function """ -Unit tests for octoprint.users +Unit tests for octoprint.access.users """ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' diff --git a/tests/util/test_misc.py b/tests/util/test_misc.py index 20da8acee..2befe21fb 100644 --- a/tests/util/test_misc.py +++ b/tests/util/test_misc.py @@ -15,7 +15,7 @@ import octoprint.util class MiscTestCase(unittest.TestCase): def test_get_class(self): - octoprint.util.get_class("octoprint.users.FilebasedUserManager") + octoprint.util.get_class("octoprint.access.users.FilebasedUserManager") def test_get_class_wrongmodule(self): try: @@ -27,7 +27,7 @@ class MiscTestCase(unittest.TestCase): def test_get_class_wrongclass(self): try: - octoprint.util.get_class("octoprint.users.FilebasedUserManagerBzzztWrong") + octoprint.util.get_class("octoprint.access.users.FilebasedUserManagerBzzztWrong") self.fail("This should have thrown an ImportError") except ImportError: # success