Skip to content

ctrlX Data Layer + Webserver

Introduction

This python app deploys a simple webserver including ctrlX Data Layer connection and user permissions with web interface accessible from ctrlX webpage.

Function Description

The app runs a simple webserver with reverse proxy and ctrlX Data Layer access, setup user permissions through package-manifest and token authentification.

Once the installation of the snap was finished, you can access to the provided webpage through the sidebar or overview menu of the ctrlX CORE webpage.

ctrlX Integration

The Python-Webpage allows you to read and write at the ctrlX Data Layer (depends on permissions of the current user) and shows permissions of the current user.

Python Webserver

You can find the configuration of user permissions (scopes) on the ctrlX at Settings > Users & Permissions > Users

ctrlX User Permissions

The integration of the app inside ctrlX Core webpage (sidebar and overview integration, reverse proxy, bearertoken, scopes) is done by the package-manifest (./configs/package-assets/rexroth-python-webserver.package-manifest.json).

Implementation Description

The app has these modules:

  • main.py connects to the ctrlX Data Layer and starts the web server. In snap environment an Unix socket connection is established otherwise a TCP/IP connection.

  • app/

  • datalayer.py handles the ctrlX Data Layer node data access.
  • ctrlx_datalayer_helper.py handles the ctrlX Data Layer client connection.

  • web/

  • unix_socket_server.py *) Web server class (wrapper) to use unix sockets instead of TCP/IP
  • request_handler.py *) Request handler class for both UNIX sockets and TCP/IP
  • web_token.py contains a helper function to check permissions using jwt
  • www/
  • favicon.png Favicon for the web site.
  • index.html The web site.
  • invalid-token.html The web content which is send when the token was wrong.
  • stylesheet.css Defines the style of the web site.

License

SPDX-FileCopyrightText: Bosch Rexroth AG SPDX-License-Identifier: MIT