Skip to main content

Decidim Settings

We call _Decidim Settings t_he Decidim Organization’s settings. As Decidim is multitenant, every tenant has its own set of settings. With voca, we do create one environment per Decidim, so we always have one and only one tenant.

If you want to access organization settings in a Decidim you can always do a cd $ROOT && bundle exec rails c and then

Decidim::Organization.first
# All the attributes of the organization will be printed out.

To access Decidim remotely, we use a gRPC server that is served on a docker image (see Control Decidim Remotely). This gRPC server has several methods, and we will focus on GetSettings and SetSettings.

SetSettings

The most complex call here is SetSettings, which allows for redefining the organization's settings. We use the classical Command pattern from the Decidim codebase:

  • The SetSettings payload is divided into commands:
    • PermissionSettings: Registration mode (whether the instance allows registrations or only sign-ins).
    • NamingSettings: Name of the organization and acronym.
    • LocaleSettings: Available and default locales.
    • SMTPSettings: Custom SMTP settings.
    • ColorSettings: Custom color for the organization.
    • FileUploadSettings: Maximum upload size and allowed files.
    • FeatureFlagSettings: Available authorizations, flag to enable groups, badges, and machine translation.

All these payload keys are optional, and if any of them exist, it triggers a Command class that handles the corresponding change.

For example, LocaleSettings is more than just a database call to change the settings. We need to rebuild the search tree and ensure that no users have a locale that no longer exists. So, in addition to the database updates, we also run system calls.

All these commands are available in our voca gem repository.