diff --git a/package/etc/ahriman.ini b/package/etc/ahriman.ini index f9ccb0d8..8f729305 100644 --- a/package/etc/ahriman.ini +++ b/package/etc/ahriman.ini @@ -8,6 +8,9 @@ database = /var/lib/pacman repositories = core extra community multilib root = / +[auth] +enabled = no + [build] archbuild_flags = build_command = extra-x86_64-build @@ -43,6 +46,5 @@ command = rsync --archive --compress --partial --delete chunk_size = 8388608 [web] -auth = no host = 127.0.0.1 templates = /usr/share/ahriman \ No newline at end of file diff --git a/package/share/ahriman/build-status.jinja2 b/package/share/ahriman/build-status.jinja2 index 4254d4ff..ddfe798f 100644 --- a/package/share/ahriman/build-status.jinja2 +++ b/package/share/ahriman/build-status.jinja2 @@ -12,9 +12,11 @@

ahriman - {{ version }} - {{ architecture }} - {{ service.status }} + {% if authorized %} + {{ version }} + {{ architecture }} + {{ service.status }} + {% endif %}

{% include "login-form.jinja2" %} @@ -31,15 +33,21 @@ status - {% for package in packages %} + {% if authorized %} + {% for package in packages %} + + {{ package.base }} + {{ package.packages|join("
"|safe) }} + {{ package.version }} + {{ package.timestamp }} + {{ package.status }} + + {% endfor %} + {% else %} - {{ package.base }} - {{ package.packages|join("
"|safe) }} - {{ package.version }} - {{ package.timestamp }} - {{ package.status }} + In order to see statuses you must login first - {% endfor %} + {% endif %} diff --git a/src/ahriman/web/views/index.py b/src/ahriman/web/views/index.py index 51a30364..6406add3 100644 --- a/src/ahriman/web/views/index.py +++ b/src/ahriman/web/views/index.py @@ -34,6 +34,7 @@ class IndexView(BaseView): It uses jinja2 templates for report generation, the following variables are allowed: architecture - repository architecture, string, required + authorized - alias for `not auth_enabled or auth_username is not None` auth_enabled - whether authorization is enabled by configuration or not, boolean, required auth_username - authorized user id if any, string. None means not authorized packages - sorted list of packages properties, required @@ -80,10 +81,15 @@ class IndexView(BaseView): "timestamp": pretty_datetime(self.service.status.timestamp) } + # auth block + auth_username = await authorized_userid(self.request) + authorized = not self.validator.enabled or auth_username is not None + return { "architecture": self.service.architecture, + "authorized": authorized, "auth_enabled": self.validator.enabled, - "auth_username": await authorized_userid(self.request), + "auth_username": auth_username, "packages": packages, "repository": self.service.repository.name, "service": service,