diff --git a/docs/bundledplugins/forcelogin.rst b/docs/bundledplugins/forcelogin.rst deleted file mode 100644 index e5214f79f..000000000 --- a/docs/bundledplugins/forcelogin.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. _sec-bundledplugins-forcelogin: - -ForceLogin Plugin -================= - -The ForceLogin Plugin comes bundled with OctoPrint (starting with version 1.3.10). It removes the anonymous -read-only access that up until 1.3.10 was standard when accessing OctoPrint instances without being logged in and -instead forces users to log in if they want to get any kind of information from OctoPrint. - -.. _fig-bundledplugins-forcelogin: -.. figure:: ../images/bundledplugins-forcelogin-dialog.png - :align: center - :alt: Forced login dialog - - OctoPrint's new forced login dialog. - -.. warning:: - - Keep in mind that **OctoPrint does not manage your webcam**, it merely embeds it. If you have a webcam, - it will still be accessible to users who are not logged in under its (guessable) URL. If you need to restrict - access to your webcam, you'll need to find a way to do so directly on the webcam server which - again - - is not OctoPrint itself. - -.. note:: - - If you want back the old behaviour of allowing anonymous read-only access to your OctoPrint instance, disable - the ForceLogin Plugin in OctoPrint's plugin manager. - -.. _sec-bundledplugins-forcelogin-sourcecode: - -Source code ------------ - -The source of the ForceLogin plugin is bundled with OctoPrint and can be found in -its source repository under ``src/octoprint/plugins/forcelogin``. diff --git a/docs/bundledplugins/index.rst b/docs/bundledplugins/index.rst index d82c3eb29..206aaab57 100644 --- a/docs/bundledplugins/index.rst +++ b/docs/bundledplugins/index.rst @@ -14,8 +14,8 @@ Bundled Plugins backup.rst discovery.rst errortracking.rst - forcelogin.rst logging.rst + loginui.rst pluginmanager.rst printer_safety_check.rst softwareupdate.rst diff --git a/docs/bundledplugins/loginui.rst b/docs/bundledplugins/loginui.rst new file mode 100644 index 000000000..1da03ce31 --- /dev/null +++ b/docs/bundledplugins/loginui.rst @@ -0,0 +1,66 @@ +.. _sec-bundledplugins-loginui: + +Login UI +======== + +The Login UI plugin has been bundled since OctoPrint 1.4.0 and replaces the ForceLogin plugin bundled with prior +versions since 1.3.10. + +If anonymous read-only access is disabled in the :ref:`Access Control settings ` +it provides a stand alone login dialog that gets displayed instead of OctoPrint's regular UI. + +.. _fig-bundledplugins-loginui: +.. figure:: ../images/bundledplugins-loginui-dialog.png + :align: center + :alt: Login dialog + + OctoPrint's login dialog. + +The plugin allows theming of the dialog through :ref:`a plugin hook `. + +.. warning:: + + Since the plugin is absolutely required for the case of anonymous read-only access because in this case the + UI itself could not even fully initialize due to a lack of permissions required to do so, it is hidden in the plugin + manager and cannot be disabled through that. + +.. _sec-bundledplugins-loginui-hooks: + +Hooks +----- + +.. _sec-bundledplugins-loginui-hooks-theming: + +octoprint.plugin.loginui.theming +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:function:: loginui_theming_hook(*args, **kwargs) + + Support theming of the login dialog, just in case the core UI is themed as well. Use to return a list of additional + CSS file URLs to inject into the login dialog HTML. + + Example usage by a plugin: + + .. code-block:: python + + def loginui_theming(): + from flask import url_for + return [url_for("plugin.myplugin.static", filename="css/loginui_theme.css")] + + __plugin_hooks__ = { + "octoprint.plugin.loginui.theming": loginui_theming + } + + Only a list of ready-made URLs to CSS files is supported, neither LESS nor JS. Best use + url_for like in the example above to be prepared for any configured prefix URLs. + + :return: A list of additional CSS URLs to inject into the login dialog. + :rtype: A list of strings. + +.. _sec-bundledplugins-loginui-sourcecode: + +Source Code +----------- + +The source of the Anonymous Usage Tracking plugin is bundled with OctoPrint and can be +found in its source repository under ``src/octoprint/plugins/loginui``. diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index 06bcc253e..4a85e65b7 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -3,8 +3,20 @@ Access Control ============== -When Access Control is enabled, anonymous users (not logged in) will only see -the read-only parts of the UI which are the following: +OctoPrint's bundled access control feature allows granular permission control +over which users or user groups are allowed to access which parts of OctoPrint. + +The default permissions will deny any kind of access to anonymous (not logged in) +users out of the box. + +.. warning:: + + Please note that OctoPrint does *not* control the webcam and merely embeds it, and + thus also cannot limit access to it. If an anonymous user correctly guesses the + webcam URL, they will thus be able to see it. + +If read-only access for anonymous users is enabled, anonymous users will have +read-only access to the following parts of the UI: * printer state * available gcode files and stats (upload is disabled) @@ -16,8 +28,8 @@ the read-only parts of the UI which are the following: * any components provided through plugins which are enabled for anonymous users -Logged in users will get access to everything besides the Settings and System -Commands, which are admin-only. +Logged in users without admin flag will be allowed to access everything besides the +Settings and System Commands, which are admin-only. If Access Control is disabled, everything is directly accessible. **That also includes all administrative functionality as well as full control over the @@ -39,6 +51,29 @@ internet or other untrusted networks!). publicly reachable by everyone with an internet connection, even with access control enabled. +.. _sec-features-access_control-hooks: + +Available Extension Hooks +------------------------- + +There are two hooks for plugins to utilize in order to +add new configurable permissions into the system and/or adjust the styling of the +login dialog. + +.. _sec-features-access_control-hooks-permissions: + +octoprint.access.permissions +............................ + +See :ref:`here `. + +.. _sec-features-access_control-hooks-loginui: + +octoprint.plugin.loginui.theming +................................ + +See :ref:`here `. + .. _sec-features-access_control-rerunning_wizard: Rerunning the wizard diff --git a/docs/images/bundledplugins-forcelogin-dialog.png b/docs/images/bundledplugins-loginui-dialog.png similarity index 100% rename from docs/images/bundledplugins-forcelogin-dialog.png rename to docs/images/bundledplugins-loginui-dialog.png diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index 7b79a96ed..4c5361ac2 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -1102,6 +1102,27 @@ octoprint.filemanager.preprocessor :return: The `file_object` as passed in or None, or a replaced version to use instead for further processing. :rtype: AbstractFileWrapper or None +.. _sec-plugins-hook-plugin-loginui-theming: + +octoprint.plugin.loginui.theming +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +See :ref:`here `. + +.. _sec-plugins-hook-plugin-pluginmanager-reconnect: + +octoprint.plugin.pluginmanager.reconnect_hooks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +See :ref:`here `. + +.. _sec-plugins-hook-plugin-softwareupdate-check_config: + +octoprint.plugin.softwareupdate.check_config +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +See :ref:`here `. + .. _sec-plugins-hook-printer-factory: octoprint.printer.factory @@ -1273,8 +1294,7 @@ octoprint.server.api.after_request Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins. - Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a - usage example. + Your plugin might need this to further restrict access to API methods. .. important:: @@ -1289,8 +1309,7 @@ octoprint.server.api.before_request Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins. - Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a - usage example. + Your plugin might need this to further restrict access to API methods. .. important:: @@ -1305,8 +1324,7 @@ octoprint.server.http.access_validator Allows adding additional access validators to the default tornado routers. - Your plugin might need to this to restrict acccess to downloads and webcam snapshots further. See the bundled - "Force Login" plugin for a usage example. + Your plugin might need to this to restrict acccess to downloads and webcam snapshots further. .. important:: @@ -1430,8 +1448,6 @@ octoprint.server.sockjs.authed Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout). - See the bundled :ref:`Forcelogin Plugin ` for an example on how to utilize this. - :param object socket: the socket object which is about to be registered :param object user: the user that got authenticated on the socket, or None if the user got deauthenticated