.. SPDX-FileCopyrightText: 2024 - 2025 Univention GmbH
..
.. SPDX-License-Identifier: AGPL-3.0-only

.. Keep the title this way,
   otherwise plugins in browsers like Mozilla Firefox hide the content
   showing a white page to the reader.

.. _customize-cookie-consent:

Consent for using cookies
=========================

.. dropdown:: Deployment — Kubernetes
   :color: info
   :icon: rocket

   This page refers to the Nubus for Kubernetes deployment.

The Univention Portal and the Keycloak sign-in form can display a cookie consent banner
to inform end users about the use of cookies and the handling of their data.
The default settings of Nubus for Kubernetes deactivate the cookie consent banner.
This page describes how to enable the cookie consent banner and how to configure its content.

.. _customize-cookie-consent-activate:

Activate and customize
----------------------

To enable and customize the cookie consent banner,
follow these steps:

#. Add a UCR configuration to your :file:`custom_values.yaml` deployment file
   under the key path ``global.configUCR.umc.cookie-banner``.
   :numref:`customize-cookie-consent-example-listing` shows an example.

   .. code-block:: yaml
      :caption: Example UCR configuration to customize the content of the cookie consent banner
      :name: customize-cookie-consent-example-listing

      global:
        configUcr:
          umc:
            cookie-banner:
              show: true
              title:
                en: "The English title for the Banner"
                de: "Der deutsche Titel für das Banner"
              text:
                en: "Custom text for your cookie consent banner."
                de: "Angepasster Text für Ihre Cookie Consent Banner."

#. Apply the changes as described in :ref:`customize-cookie-consent-apply`.

.. _customize-cookie-consent-deactivate:

Deactivate
----------

To deactivate the cookie consent banner,
follow these steps:

#. To deactivate the cookie consent banner,
   in your :file:`custom_values.yaml` deployment file,

   * you either have to set ``global.configUcr.umc.cookie-banner.show`` to ``false``,
   * or remove the configuration under the ``global.configUcr.umc.cookie-banner`` path.

   :numref:`customize-cookie-consent-deactivate-listing` shows an example.

   .. code-block:: yaml
      :caption: Deactivate the cookie consent banner with ``….show: false``
      :name: customize-cookie-consent-deactivate-listing

      global:
        configUcr:
          umc:
            cookie-banner:
              show: false

#. Apply the changes as described in :ref:`customize-cookie-consent-apply`.

.. _customize-cookie-consent-apply:

Apply changes
-------------

#. To apply the updated configuration in your :file:`custom_values.yaml` file to Nubus,
   run the commands in shown :numref:`customize-cookie-consent-apply-changes-listing`.

   .. code-block:: console
      :caption: Apply customization to Nubus
      :name: customize-cookie-consent-apply-changes-listing

      $ export NAMESPACE_FOR_NUBUS="Set to your Kubernetes namespace"
      $ export RELEASE_NAME="The Helm Chart release name"
      $ export VERSION="Your version of Nubus"
      $ helm upgrade \
         "$RELEASE_NAME" \
         --namespace="$NAMESPACE_FOR_NUBUS" \
         oci://artifacts.software-univention.de/nubus/charts/nubus \
         --values custom_values.yaml \
         --version "$VERSION"

#. To ensure that the portal applies the settings for the cookie consent banner,
   you must restart the Kubernetes pod for the *UMC Gateway*,
   because it provides the necessary data to the portal.
   Run the commands as shown in :numref:`customize-cookie-consent-restart-umc-gateway-listing`.

   .. code-block:: console
      :caption: Restart pod for portal frontend to apply customization
      :name: customize-cookie-consent-restart-umc-gateway-listing

      $ kubectl --namespace "$NAMESPACE_FOR_NUBUS" get pods | grep "umc-gateway"
      $ export NAME_OF_POD="Name of the pod in the output of the previous command."
      $ kubectl --namespace "$NAMESPACE_FOR_NUBUS" delete pod $NAME_OF_POD
