Metadata-Version: 2.5
Name: trytond_strings_xo_web
Version: 8.0.0.1
Summary: Xen Orchestra Self-Service Portal
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: orchestra,portal,tryton,virtualization,xcp-ng,xen
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Requires-Dist: trytond-company<8.1,>=8.0
Requires-Dist: trytond-strings-xo<8.1,>=8.0
Requires-Dist: trytond-web-user<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Xen Orchestra Self-Service Portal
=================================

The ``strings_xo_web`` module is the Tryton side of the Xen Orchestra
self-service portal.  It complements the ``strings_xo`` suite with the
portal configuration of a Xen Orchestra server and a read-only REST API
consumed by the ``fe_strings_xo`` flask_portal module.

Features
--------

- **Portal visibility**: a *Self-Service Portal* flag on every Xen
  Orchestra server marks the servers whose virtual machines are offered
  to the web users.
- **Read-only REST API**: the ``/<database>/xo/`` endpoints, protected
  by the ``web.user`` bearer session, publish the portal servers, the
  virtual machines owned by the authenticated user and the availability
  status of the inventory.
- **Fail closed ownership**: a web user only ever sees the virtual
  machines owned by its parties; when the ownership of a virtual
  machine cannot be established the portal returns an empty inventory
  instead of exposing every machine.
- **Security**: a dedicated ``Xen Orchestra Web User`` group and the
  server secrets stay protected by the field level access rights of the
  ``strings_xo`` module; the API never serialises a secret field.

Virtual machine inventory
-------------------------

The ``xo.vm`` model is provided by the ``strings_xo_compute`` module
(Heptapod issue #645).  Because the portal must remain installable while
the compute inventory is being built, ``strings_xo_compute`` is *not* a
dependency of this module:

- when ``xo.vm`` is not installed, ``GET /<database>/xo/vms`` answers an
  empty list and ``GET /<database>/xo/inventory`` reports
  ``available: false``;
- once the compute module is installed, the machines owned by the web
  user are listed automatically, restricted to the portal enabled
  servers.

Configuration
-------------

After installing the module, open *Xen Orchestra > Servers* and check
*Self-Service Portal* on the servers that should be offered to the web
users.  The portal module itself is declared to the Flask Portal through
the ``flask_board.cfg`` file of the module (section
``[portal:fe_strings_xo]``).

Dependencies
------------

- Tryton modules: ``ir``, ``res``, ``company``, ``strings_xo``,
  ``web_user``.

Models
------

- ``xo.server`` — extended with the *Self-Service Portal* flag
  (``web_enabled``).

REST API
--------

All the endpoints are mounted under ``/<database>/xo/`` and require an
``Authorization: Bearer <session_key>`` header.

- ``GET /<database>/xo/servers`` — the portal enabled servers.
- ``GET /<database>/xo/vms`` — the virtual machines of the
  authenticated web user.
- ``GET /<database>/xo/vms/<id>`` — a single virtual machine.
- ``GET /<database>/xo/inventory`` — the inventory status.
