Skip to content

Commit

Permalink
Move eherkenning eenmanszaak flag to more natural SiteConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
swrichards committed Feb 4, 2025
1 parent 6455e92 commit eb45cea
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/open_inwoner/configurations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class SiteConfigurationAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
"name",
"login_show",
"login_allow_registration",
"enable_eherkenning_for_eenmanszaak",
"login_2fa_sms",
"allow_messages_file_sharing",
"redirect_to",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 4.2.18 on 2025-02-04 09:07

import logging

from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import migrations, models

logger = logging.getLogger(__name__)


def copy_setting_from_openzaak_config(apps, _):
OpenZaakConfig = apps.get_model("openzaak", "OpenZaakConfig")
SiteConfiguration = apps.get_model("configurations", "SiteConfiguration")

try:
openzaak_config = OpenZaakConfig.objects.get() # should be a singleton
site_config = SiteConfiguration.objects.get()
except (ObjectDoesNotExist, MultipleObjectsReturned) as exc:
logger.warning(
"Unable to migrate `enable_eherkenning_for_eenmanszaak` flag from OpenZaakConfig, unable to fetch singletons",
exc_info=True,
)
else:
site_config.enable_eherkenning_for_eenmanszaak = (
openzaak_config.enable_eherkenning_for_eenmanszaak
)
site_config.save()


class Migration(migrations.Migration):

dependencies = [
("configurations", "0074_alter_siteconfiguration_accent_color_and_more"),
("openzaak", "0063_alter_openzaakconfig_show_cases_without_status"),
]

operations = [
migrations.AddField(
model_name="siteconfiguration",
name="enable_eherkenning_for_eenmanszaak",
field=models.BooleanField(
default=False,
help_text="If enabled, eenmanszaken may authenticate using eHerkenning and subsequently their kvk nummer will be used to interface with the zaken and klanten backends). If not, an eenmanszaak will be forced to use DigiD, and the user's BSN will be used instead.",
verbose_name="Allow eenmanszaken to authenticate using eHerkenning",
),
),
migrations.RunPython(
copy_setting_from_openzaak_config, reverse_code=migrations.RunPython.noop
),
]
10 changes: 10 additions & 0 deletions src/open_inwoner/configurations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ class SiteConfiguration(SingletonModel):
verbose_name=_("Login tekst"),
help_text=_("Deze tekst wordt getoond op de login pagina."),
)
enable_eherkenning_for_eenmanszaak = models.BooleanField(
verbose_name=_("Allow eenmanszaken to authenticate using eHerkenning"),
help_text=_(
"If enabled, eenmanszaken may authenticate using eHerkenning and "
"subsequently their kvk nummer will be used to interface with the zaken and"
" klanten backends). If not, an eenmanszaak will be forced to use DigiD, "
" and the user's BSN will be used instead."
),
default=False,
)
registration_text = models.TextField(
blank=True,
verbose_name=_("Registratie tekst"),
Expand Down
1 change: 0 additions & 1 deletion src/open_inwoner/openzaak/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class OpenZaakConfigAdmin(SingletonModelAdmin):
"zaken_filter_enabled",
"show_cases_without_status",
"order_statuses_by_date_set",
"enable_eherkenning_for_eenmanszaak",
),
},
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.18 on 2025-02-04 09:07

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0063_alter_openzaakconfig_show_cases_without_status"),
("configurations", "0075_siteconfiguration_enable_eherkenning_for_eenmanszaak"),
]

operations = [
migrations.RemoveField(
model_name="openzaakconfig",
name="enable_eherkenning_for_eenmanszaak",
),
]
11 changes: 0 additions & 11 deletions src/open_inwoner/openzaak/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,6 @@ def form_service(self, service):
default=False,
)

enable_eherkenning_for_eenmanszaak = models.BooleanField(
verbose_name=_("Allow eenmanszaken to authenticate using eHerkenning"),
help_text=_(
"If enabled, eenmanszaken may authenticate using eHerkenning and "
"subsequently their kvk nummer will be used to interface with the zaken and"
" klanten backends). If not, an eenmanszaak will be forced to use DigiD, "
" and the user's BSN will be used instead."
),
default=False,
)

derive_zaak_titel_from = models.CharField(
choices=ZaakTitleDisplayChoices.choices,
default=ZaakTitleDisplayChoices.zaaktype_omschrijving,
Expand Down

0 comments on commit eb45cea

Please sign in to comment.