diff --git a/docs/configuration/digid_oidc.rst b/docs/configuration/digid_oidc.rst index 1e43e98ffd..995091b87b 100644 --- a/docs/configuration/digid_oidc.rst +++ b/docs/configuration/digid_oidc.rst @@ -1,10 +1,6 @@ .. _digid_oidc: - -======================== -DigiD OIDC configuration -======================== - +DIGID OIDC Configuration Settings Overview ================= @@ -55,141 +51,121 @@ Detailed Information Variable DIGID_OIDC_OIDC_RP_CLIENT_ID Setting OpenID Connect client ID Description OpenID Connect client ID provided by the OIDC Provider - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_RP_CLIENT_SECRET Setting OpenID Connect secret Description OpenID Connect secret provided by the OIDC Provider - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_RP_SIGN_ALGO Setting OpenID sign algorithm Description Algorithm the Identity Provider uses to sign ID tokens - Model field type CharField Possible values string Default value HS256 Variable DIGID_OIDC_OIDC_OP_DISCOVERY_ENDPOINT Setting Discovery endpoint Description URL of your OpenID Connect provider discovery endpoint ending with a slash (`.well-known/...` will be added automatically). If this is provided, the remaining endpoints can be omitted, as they will be derived from this endpoint. - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_OP_JWKS_ENDPOINT Setting JSON Web Key Set endpoint Description URL of your OpenID Connect provider JSON Web Key Set endpoint. Required if `RS256` is used as signing algorithm. - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_OP_AUTHORIZATION_ENDPOINT Setting Authorization endpoint Description URL of your OpenID Connect provider authorization endpoint - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_OP_TOKEN_ENDPOINT Setting Token endpoint Description URL of your OpenID Connect provider token endpoint - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_OP_USER_ENDPOINT Setting User endpoint Description URL of your OpenID Connect provider userinfo endpoint - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_RP_IDP_SIGN_KEY Setting Sign key Description Key the Identity Provider uses to sign ID tokens in the case of an RSA sign algorithm. Should be the signing key in PEM or DER format. - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_OIDC_USE_NONCE Setting Use nonce Description Controls whether the OpenID Connect client uses nonce verification - Model field type BooleanField Possible values True, False Default value True Variable DIGID_OIDC_OIDC_NONCE_SIZE Setting Nonce size Description Sets the length of the random string used for OpenID Connect nonce verification - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value 32 Variable DIGID_OIDC_OIDC_STATE_SIZE Setting State size Description Sets the length of the random string used for OpenID Connect state verification - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value 32 Variable DIGID_OIDC_OIDC_EXEMPT_URLS Setting URLs exempt from session renewal Description This is a list of absolute url paths, regular expressions for url paths, or Django view names. This plus the mozilla-django-oidc urls are exempted from the session renewal by the SessionRefresh middleware. - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value [] Variable DIGID_OIDC_USERINFO_CLAIMS_SOURCE Setting user information claims extracted from Description Indicates the source from which the user information claims should be extracted. - Model field type CharField - Possible values string + Possible values userinfo_endpoint, id_token Default value userinfo_endpoint Variable DIGID_OIDC_OIDC_OP_LOGOUT_ENDPOINT Setting Logout endpoint Description URL of your OpenID Connect provider logout endpoint - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_ERROR_MESSAGE_MAPPING Setting Error message mapping Description Mapping that maps error messages returned by the identity provider to human readable error messages that are shown to the user - Model field type JSONField Possible values No information available - Default value No information + Default value {} Variable DIGID_OIDC_OIDC_KEYCLOAK_IDP_HINT Setting Keycloak Identity Provider hint Description Specific for Keycloak: parameter that indicates which identity provider should be used (therefore skipping the Keycloak login screen). - Model field type CharField Possible values string Default value No default Variable DIGID_OIDC_ENABLED Setting enable Description Indicates whether OpenID Connect for authentication/authorization is enabled. This overrides overrides the usage of SAML for DigiD authentication. - Model field type BooleanField Possible values True, False Default value False Variable DIGID_OIDC_IDENTIFIER_CLAIM_NAME Setting BSN claim name Description The name of the claim in which the BSN of the user is stored - Model field type CharField Possible values string Default value bsn Variable DIGID_OIDC_OIDC_RP_SCOPES_LIST Setting OpenID Connect scopes Description OpenID Connect scopes that are requested during login. These scopes are hardcoded and must be supported by the identity provider - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value ['openid', 'bsn'] \ No newline at end of file diff --git a/docs/configuration/eherkenning_oidc.rst b/docs/configuration/eherkenning_oidc.rst index 20e526c104..cea7dc9363 100644 --- a/docs/configuration/eherkenning_oidc.rst +++ b/docs/configuration/eherkenning_oidc.rst @@ -1,10 +1,6 @@ .. _eherkenning_oidc: - -======================== -eHerkenning OIDC configuration -======================== - +eHerkenning OIDC Configuration Settings Overview ================= @@ -55,141 +51,121 @@ Detailed Information Variable EHERKENNING_OIDC_OIDC_RP_CLIENT_ID Setting OpenID Connect client ID Description OpenID Connect client ID provided by the OIDC Provider - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_RP_CLIENT_SECRET Setting OpenID Connect secret Description OpenID Connect secret provided by the OIDC Provider - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_RP_SIGN_ALGO Setting OpenID sign algorithm Description Algorithm the Identity Provider uses to sign ID tokens - Model field type CharField Possible values string Default value HS256 Variable EHERKENNING_OIDC_OIDC_OP_DISCOVERY_ENDPOINT Setting Discovery endpoint Description URL of your OpenID Connect provider discovery endpoint ending with a slash (`.well-known/...` will be added automatically). If this is provided, the remaining endpoints can be omitted, as they will be derived from this endpoint. - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_OP_JWKS_ENDPOINT Setting JSON Web Key Set endpoint Description URL of your OpenID Connect provider JSON Web Key Set endpoint. Required if `RS256` is used as signing algorithm. - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_OP_AUTHORIZATION_ENDPOINT Setting Authorization endpoint Description URL of your OpenID Connect provider authorization endpoint - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_OP_TOKEN_ENDPOINT Setting Token endpoint Description URL of your OpenID Connect provider token endpoint - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_OP_USER_ENDPOINT Setting User endpoint Description URL of your OpenID Connect provider userinfo endpoint - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_RP_IDP_SIGN_KEY Setting Sign key Description Key the Identity Provider uses to sign ID tokens in the case of an RSA sign algorithm. Should be the signing key in PEM or DER format. - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_OIDC_USE_NONCE Setting Use nonce Description Controls whether the OpenID Connect client uses nonce verification - Model field type BooleanField Possible values True, False Default value True Variable EHERKENNING_OIDC_OIDC_NONCE_SIZE Setting Nonce size Description Sets the length of the random string used for OpenID Connect nonce verification - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value 32 Variable EHERKENNING_OIDC_OIDC_STATE_SIZE Setting State size Description Sets the length of the random string used for OpenID Connect state verification - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value 32 Variable EHERKENNING_OIDC_OIDC_EXEMPT_URLS Setting URLs exempt from session renewal Description This is a list of absolute url paths, regular expressions for url paths, or Django view names. This plus the mozilla-django-oidc urls are exempted from the session renewal by the SessionRefresh middleware. - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value [] Variable EHERKENNING_OIDC_USERINFO_CLAIMS_SOURCE Setting user information claims extracted from Description Indicates the source from which the user information claims should be extracted. - Model field type CharField - Possible values string + Possible values userinfo_endpoint, id_token Default value userinfo_endpoint Variable EHERKENNING_OIDC_OIDC_OP_LOGOUT_ENDPOINT Setting Logout endpoint Description URL of your OpenID Connect provider logout endpoint - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_ERROR_MESSAGE_MAPPING Setting Error message mapping Description Mapping that maps error messages returned by the identity provider to human readable error messages that are shown to the user - Model field type JSONField Possible values No information available - Default value No information + Default value {} Variable EHERKENNING_OIDC_OIDC_KEYCLOAK_IDP_HINT Setting Keycloak Identity Provider hint Description Specific for Keycloak: parameter that indicates which identity provider should be used (therefore skipping the Keycloak login screen). - Model field type CharField Possible values string Default value No default Variable EHERKENNING_OIDC_ENABLED Setting enable Description Indicates whether OpenID Connect for authentication/authorization is enabled. This overrides overrides the usage of SAML for eHerkenning authentication. - Model field type BooleanField Possible values True, False Default value False Variable EHERKENNING_OIDC_IDENTIFIER_CLAIM_NAME Setting KVK claim name Description The name of the claim in which the KVK of the user is stored - Model field type CharField Possible values string Default value kvk Variable EHERKENNING_OIDC_OIDC_RP_SCOPES_LIST Setting OpenID Connect scopes Description OpenID Connect scopes that are requested during login. These scopes are hardcoded and must be supported by the identity provider - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value ['openid', 'kvk'] \ No newline at end of file diff --git a/docs/configuration/general.rst b/docs/configuration/general.rst index a94dde1d5b..6804bf03ad 100644 --- a/docs/configuration/general.rst +++ b/docs/configuration/general.rst @@ -33,8 +33,7 @@ If the project is being configured for the first time, run the command from the src/manage.py setup_configuration - -By default, ``setup_configuration`` checks if a configuration already exists and will stop executing if it finds one. In order to overwrite an existing configuration, use: +By default, ``setup_configuration`` checks per configuration step if it is already configured and skips this step if that is the case. In order to overwrite an existing configuration, use: :: diff --git a/docs/configuration/kic.rst b/docs/configuration/kic.rst index f36637baa8..6bd5e23ab1 100644 --- a/docs/configuration/kic.rst +++ b/docs/configuration/kic.rst @@ -1,10 +1,6 @@ .. _kic: - -===================== -Klanten configuration -===================== - +Klanten Configuration Settings Overview ================= @@ -48,49 +44,42 @@ Detailed Information Variable KIC_CONFIG_REGISTER_EMAIL Setting Registreer op email adres Description - Model field type CharField Possible values string Default value No default Variable KIC_CONFIG_REGISTER_CONTACT_MOMENT Setting Registreer in Contactmomenten API Description - Model field type BooleanField Possible values True, False Default value False Variable KIC_CONFIG_REGISTER_BRONORGANISATIE_RSIN Setting Organisatie RSIN Description - Model field type CharField Possible values string Default value Variable KIC_CONFIG_REGISTER_CHANNEL Setting Contactmoment kanaal Description The channel through which contactmomenten are created - Model field type CharField Possible values string Default value contactformulier Variable KIC_CONFIG_REGISTER_TYPE Setting Contactmoment type Description Naam van 'contacttype' uit e-Suite - Model field type CharField Possible values string Default value Melding Variable KIC_CONFIG_REGISTER_EMPLOYEE_ID Setting Medewerker identificatie Description Gebruikersnaam van actieve medewerker uit e-Suite - Model field type CharField Possible values string Default value Variable KIC_CONFIG_USE_RSIN_FOR_INNNNPID_QUERY_PARAMETER Setting Haal bronnen op uit de Klanten- en Contactmomenten-API's voor gebruikers die zijn geauthenticeerd met eHerkenning via RSIN Description Indien ingeschakeld, worden bronnen uit de Klanten- en Contactmomenten-API's voor eHerkenning-gebruikers opgehaald via RSIN (Open Klant). Indien niet ingeschakeld, worden deze bronnen via het KVK-nummer. - Model field type BooleanField Possible values True, False Default value False diff --git a/docs/configuration/siteconfig.rst b/docs/configuration/siteconfig.rst index fdb80617f4..f29a555f8a 100644 --- a/docs/configuration/siteconfig.rst +++ b/docs/configuration/siteconfig.rst @@ -1,10 +1,6 @@ .. _siteconfig: - -===================== -General configuration -===================== - +General Configuration Settings Overview ================= @@ -105,476 +101,408 @@ Detailed Information Variable SITE_NAME Setting Naam Description Naam van de gemeente - Model field type CharField Possible values string Default value No default Variable SITE_PRIMARY_COLOR Setting Primaire kleur Description Hoofdkleur van de gemeentesite/huisstijl - Model field type CharField Possible values string Default value #FFFFFF Variable SITE_SECONDARY_COLOR Setting Secundaire kleur Description Secundaire kleur van de gemeentesite/huisstijl - Model field type CharField Possible values string Default value #FFFFFF Variable SITE_ACCENT_COLOR Setting Accentkleur Description Accentkleur van de gemeentesite/huisstijl - Model field type CharField Possible values string Default value #FFFFFF Variable SITE_PRIMARY_FONT_COLOR Setting Primaire tekstkleur Description De tekstkleur voor wanneer de achtergrond de hoofdkleur is - Model field type CharField - Possible values string + Possible values #FFFFFF, #4B4B4B Default value #FFFFFF Variable SITE_SECONDARY_FONT_COLOR Setting Secundaire tekstkleur Description De tekstkleur voor wanneer de achtergrond de secundaire kleur is - Model field type CharField - Possible values string + Possible values #FFFFFF, #4B4B4B Default value #FFFFFF Variable SITE_ACCENT_FONT_COLOR Setting Accent tekstkleur Description De tekstkleur voor wanneer de achtergrond de accentkleur is - Model field type CharField - Possible values string + Possible values #FFFFFF, #4B4B4B Default value #4B4B4B Variable SITE_WARNING_BANNER_ENABLED Setting Toon waarschuwingsbanner Description Of de waarschuwingsbanner zichtbaar moet zijn of niet. - Model field type BooleanField Possible values True, False Default value False Variable SITE_WARNING_BANNER_TEXT Setting Tekstinhoud waarschuwingsbanner Description De tekst die zichtbaar is in de waarschuwingsbanner - Model field type TextField Possible values string Default value No default Variable SITE_WARNING_BANNER_BACKGROUND_COLOR Setting Waarschuwingsbanner achtergrond Description Waarschuwingsbanner achtergrondkleur - Model field type CharField Possible values string Default value #FFDBAD Variable SITE_WARNING_BANNER_FONT_COLOR Setting Waarschuwingsbanner tekst Description De tekstkleur voor de waarschuwingsbanner - Model field type CharField Possible values string Default value #000000 Variable SITE_LOGIN_SHOW Setting Toon inlogknop rechts bovenin Description Wanneer deze optie uit staat dan kan nog wel worden ingelogd via /accounts/login/ , echter het inloggen is verborgen - Model field type BooleanField Possible values True, False Default value True Variable SITE_LOGIN_ALLOW_REGISTRATION Setting Sta lokale registratie toe Description Wanneer deze optie uit staat is het enkel toegestaan om met DigiD in te loggen. Zet deze instelling aan om ook het inloggen met gebruikersnaam/wachtwoord en het aanmelden zonder DigiD toe te staan. - Model field type BooleanField Possible values True, False Default value False Variable SITE_LOGIN_2FA_SMS Setting Log in met 2FA-met-SMS Description Bepaalt of gebruikers die met gebruikersnaam+wachtwoord inloggen verplicht een SMS verificatiecode dienen in te vullen - Model field type BooleanField Possible values True, False Default value False Variable SITE_LOGIN_TEXT Setting Login tekst Description Deze tekst wordt getoond op de login pagina. - Model field type TextField Possible values string Default value No default Variable SITE_REGISTRATION_TEXT Setting Registratie tekst Description Deze tekst wordt getoond op de registratie pagina. - Model field type TextField Possible values string Default value No default Variable SITE_HOME_WELCOME_TITLE Setting Koptekst homepage Description Koptekst op de homepage - Model field type CharField Possible values string - Default value No information + Default value Welkom Variable SITE_HOME_WELCOME_INTRO Setting Introductietekst homepage Description Introductietekst op de homepage - Model field type TextField Possible values string Default value No default Variable SITE_HOME_THEME_TITLE Setting Titel 'Onderwerpen' op de homepage Description Koptekst van de Onderwerpen op de homepage - Model field type CharField Possible values string - Default value No information + Default value Onderwerpen Variable SITE_HOME_THEME_INTRO Setting Onderwerpen introductietekst op de homepage Description Introductietekst 'Onderwerpen' op de homepage - Model field type TextField Possible values string Default value No default Variable SITE_THEME_TITLE Setting Onderwerpen titel Description Titel op de Onderwerpenpagina - Model field type CharField Possible values string - Default value No information + Default value Onderwerpen Variable SITE_THEME_INTRO Setting Onderwerpen introductie Description Introductietekst op de onderwerpenpagina - Model field type TextField Possible values string Default value No default Variable SITE_HOME_MAP_TITLE Setting Koptekst van de kaart op de homepage Description Koptekst van de kaart op de homepage - Model field type CharField Possible values string - Default value No information + Default value In de buurt Variable SITE_HOME_MAP_INTRO Setting Introductietekst kaart Description Introductietekst van de kaart op de homepage - Model field type TextField Possible values string Default value No default Variable SITE_HOME_QUESTIONNAIRE_TITLE Setting Titel vragenlijst homepage Description Vragenlijst titel op de homepage. - Model field type CharField Possible values string - Default value No information + Default value Waar bent u naar op zoek? Variable SITE_HOME_QUESTIONNAIRE_INTRO Setting Introductietekst vragenlijst homepage Description Vragenlijst introductietekst op de homepage. - Model field type TextField Possible values string - Default value No information + Default value Test met een paar simpele vragen of u recht heeft op een product Variable SITE_HOME_PRODUCT_FINDER_TITLE Setting Productzoeker titel Description Titel van de productzoeker op de homepage. - Model field type CharField Possible values string - Default value No information + Default value Productzoeker Variable SITE_HOME_PRODUCT_FINDER_INTRO Setting Introductietekst productzoeker homepage Description Introductietekst van de productzoeker op de homepage. - Model field type TextField Possible values string - Default value No information + Default value Met een paar simpele vragen ziet u welke producten passen bij uw situatie Variable SITE_SELECT_QUESTIONNAIRE_TITLE Setting Titel vragenlijst widget Description Vragenlijst keuzetitel op de onderwerpen en profielpagina's. - Model field type CharField Possible values string - Default value No information + Default value Keuze zelftest? Variable SITE_SELECT_QUESTIONNAIRE_INTRO Setting Introductietekst vragenlijst widget Description Vragenlijst introductietekst op de onderwerpen en profielpagina's. - Model field type TextField Possible values string - Default value No information + Default value Kies hieronder één van de volgende vragenlijsten om de zelftest te starten. Variable SITE_PLANS_INTRO Setting Introductietekst Samenwerken Description Subtitel voor de planpagina. - Model field type TextField Possible values string - Default value No information + Default value Hier werkt u aan uw doelen. Dit doet u samen met uw contactpersoon bij de gemeente. Variable SITE_PLANS_NO_PLANS_MESSAGE Setting Standaardtekst geen samenwerkingen Description Het bericht als een gebruiker nog geen plannen heeft. - Model field type CharField Possible values string - Default value No information + Default value U heeft nog geen plan gemaakt. Variable SITE_PLANS_EDIT_MESSAGE Setting Standaardtekst 'doel wijzigen' Description Het bericht wanneer een gebruiker een doel wijzigt. - Model field type CharField Possible values string - Default value No information + Default value Hier kunt u uw doel aanpassen Variable SITE_FOOTER_LOGO_TITLE Setting Footer logo title Description The title - help text of the footer logo. - Model field type CharField Possible values string Default value Variable SITE_FOOTER_LOGO_URL Setting Footer logo link Description The external link for the footer logo. - Model field type CharField Possible values string Default value Variable SITE_HOME_HELP_TEXT Setting Helptekst homepage Description Helptekst in de popup op de voorpagina - Model field type TextField Possible values string - Default value No information + Default value Welkom! Op dit scherm vindt u een overzicht van de verschillende onderwerpen en producten & diensten. Variable SITE_THEME_HELP_TEXT Setting Onderwerpen help Description Helptekst in de popup op de onderwerpenpagina - Model field type TextField Possible values string - Default value No information + Default value Op dit scherm vindt u de verschillende onderwerpen waarvoor wij producten en diensten aanbieden. Variable SITE_PRODUCT_HELP_TEXT Setting Helptekst producten Description Helptekst in de popup van de productenpagina's - Model field type TextField Possible values string - Default value No information + Default value Op dit scherm kunt u de details vinden over het gekozen product of dienst. Afhankelijk van het product kunt u deze direct aanvragen of meer informatie opvragen. Variable SITE_SEARCH_HELP_TEXT Setting Helptekst zoeken Description De helptekst in de popup op de zoekpagina's - Model field type TextField Possible values string - Default value No information + Default value Op dit scherm kunt u zoeken naar de producten en diensten. Variable SITE_ACCOUNT_HELP_TEXT Setting Helptekst mijn profiel Description De helptekst in de popup van de profielpagina's - Model field type TextField Possible values string - Default value No information + Default value Op dit scherm ziet u uw persoonlijke profielgegevens en gerelateerde gegevens. Variable SITE_QUESTIONNAIRE_HELP_TEXT Setting Helptekst vragenlijst/zelftest Description De helptekst in de popup op de vragenlijst/zelftestpagina's - Model field type TextField Possible values string - Default value No information + Default value Het onderdeel Zelftest stelt u in staat om met het beantwoorden van enkele vragen een advies te krijgen van de gemeente, met concrete vervolgstappen en producten en diensten. U kunt tevens uw antwoorden en het advies bewaren om met een begeleider van de gemeente te bespreken. Variable SITE_PLAN_HELP_TEXT Setting Helptekst samenwerken Description De helptekst in de popup van de samenwerken-pagina's - Model field type TextField Possible values string - Default value No information + Default value Met het onderdeel Samenwerken kunt u samen met uw contactpersonen of begeleider van de gemeente aan de slag om met een samenwerkingsplan uw persoonlijke situatie te verbeteren. Door samen aan uw doelen te werken en acties te omschrijven kunnen we elkaar helpen. Variable SITE_SEARCH_FILTER_CATEGORIES Setting Onderwerpenfilter toevoegen aan zoekresultaten Description Of er categorie-selectievakjes moeten worden weergegeven om het zoekresultaat te filteren. - Model field type BooleanField Possible values True, False Default value True Variable SITE_SEARCH_FILTER_TAGS Setting Tagfilter toevoegen aan zoekresultaten Description Of er tag-selectievakjes moeten worden weergegeven om het zoekresultaat te filteren. - Model field type BooleanField Possible values True, False Default value True Variable SITE_SEARCH_FILTER_ORGANIZATIONS Setting Organisaties-filter toevoegen aan zoekresultaten Description Of er organisatie-selectievakjes moeten worden weergegeven om het zoekresultaat te filteren. - Model field type BooleanField Possible values True, False Default value True Variable SITE_EMAIL_NEW_MESSAGE Setting Stuur een mail bij nieuwe berichten Description Of er een e-mail ter notificatie verstuurd dient te worden na een nieuw bericht voor de gebruiker. - Model field type BooleanField Possible values True, False Default value True Variable SITE_RECIPIENTS_EMAIL_DIGEST Setting ontvangers e-mailsamenvatting Description De e-mailadressen van beheerders die een dagelijkse samenvatting dienen te krijgen van punten van orde. - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value [] Variable SITE_EMAIL_VERIFICATION_REQUIRED Setting Email verification required Description Whether to require users to verify their email address - Model field type BooleanField Possible values True, False Default value False Variable SITE_CONTACT_PHONENUMBER Setting Telefoonnummer Description Telefoonnummer van de organisatie - Model field type CharField Possible values string Default value No default Variable SITE_CONTACT_PAGE Setting URL Description URL van de contactpagina van de organisatie - Model field type CharField Possible values string Default value No default Variable SITE_GTM_CODE Setting Google Tag Manager code Description Normaalgesproken is dit een code van het formaat 'GTM-XXXX'. Door dit in te stellen wordt Google Tag Manager gebruikt. - Model field type CharField Possible values string Default value No default Variable SITE_GA_CODE Setting Google Analytics code Description Normaalgesproken is dit een code van het formaat 'G-XXXX'. Door dit in te stellen wordt Google Analytics gebruikt. - Model field type CharField Possible values string Default value No default Variable SITE_MATOMO_URL Setting Matamo server URL Description De domeinnaam / URL van de Matamo server, bijvoorbeeld 'matamo.example.com'. - Model field type CharField Possible values string Default value No default Variable SITE_MATOMO_SITE_ID Setting Matamo site ID Description De 'idsite' van de website in Matamo die getrackt dient te worden. - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value No default Variable SITE_SITEIMPROVE_ID Setting SiteImprove ID Description SiteImprove ID - Dit nummer kan gevonden worden in de SiteImprove snippet, dit is onderdeel van een URL zoals '//siteimproveanalytics.com/js/siteanalyze_xxxxx.js' waarbij het xxxxx-deel de SiteImprove ID is die hier ingevuld moet worden. - Model field type CharField Possible values string Default value Variable SITE_COOKIE_INFO_TEXT Setting Tekst cookiebanner informatie Description De tekstinhoud van de cookiebanner. Wanneer deze wordt ingevuld dan wordt de cookiebanner zichtbaar. - Model field type CharField Possible values string - Default value No information + Default value Wij gebruiken cookies om onze website en dienstverlening te verbeteren. Variable SITE_COOKIE_LINK_TEXT Setting Tekst cookiebanner link Description De tekst die wordt gebruikt als link naar de privacypagina. - Model field type CharField Possible values string - Default value No information + Default value Lees meer over ons cookiebeleid. Variable SITE_COOKIE_LINK_URL Setting URL van de privacypagina Description De link naar de pagina met het privacybeleid. - Model field type CharField Possible values string Default value /pages/privacyverklaring/ Variable SITE_KCM_SURVEY_LINK_TEXT Setting KCM survey link text Description The text that is displayed on the customer satisfaction survey link - Model field type CharField Possible values string Default value No default Variable SITE_KCM_SURVEY_LINK_URL Setting KCM survey URL Description The external link for the customer satisfaction survey. - Model field type CharField Possible values string Default value No default Variable SITE_OPENID_CONNECT_LOGIN_TEXT Setting OpenID Connect login tekst Description De tekst die getoond wordt wanneer OpenID Connect (OIDC/Azure AD) als loginmethode is ingesteld - Model field type CharField Possible values string Default value Login with Azure AD Variable SITE_OPENID_DISPLAY Setting Toon optie om in te loggen via OpenID Connect Description Alleen geselecteerde groepen zullen de optie zien om met OpenID Connect in te loggen. - Model field type CharField - Possible values string + Possible values admin, regular Default value admin Variable SITE_REDIRECT_TO Setting Stuur niet-ingelogde gebruiker door naar Description Geef een URL of pad op waar de niet-ingelogde gebruiker naar toe doorgestuurd moet worden vanuit de niet-ingelogde homepage.Pad voorbeeld: '/accounts/login', URL voorbeeld: 'https://gemeente.groningen.nl' - Model field type CharField Possible values string Default value No default Variable SITE_ALLOW_MESSAGES_FILE_SHARING Setting Sta het delen van bestanden via Mijn Berichten toe Description Of het delen van bestanden via Mijn Berichten mogelijk is of niet. Indien uitgeschakeld dan kunnen alleen tekstberichten worden verzonden - Model field type BooleanField Possible values True, False Default value True Variable SITE_HIDE_CATEGORIES_FROM_ANONYMOUS_USERS Setting Blokkeer toegang tot Onderwerpen voor niet-ingelogde gebruikers Description Indien geselecteerd: alleen ingelogde gebruikers hebben toegang tot Onderwerpen. - Model field type BooleanField Possible values True, False Default value False Variable SITE_HIDE_SEARCH_FROM_ANONYMOUS_USERS Setting Verberg zoekbalk voor anonieme gebruiker Description Indien geselecteerd: alleen ingelogde gebruikers zien de zoekfunctie. - Model field type BooleanField Possible values True, False Default value False Variable SITE_DISPLAY_SOCIAL Setting Toon sociale media knoppen bij elk product Description Maak het delen mogelijk van producten op sociale media (Facebook, LinkedIn...) - Model field type BooleanField Possible values True, False Default value True Variable SITE_EHERKENNING_ENABLED Setting eHerkenning authentication ingeschakeld Description Of gebruikers in kunnen loggen met eHerkenning of niet. Standaard wordt de SAML integratie hiervoor gebruikt (van toepassing bij een rechtstreekse aansluiting op een eHerkenning makelaar). Voor het gebruiken van een OpenID Connect (OIDC) koppeling, navigeer naar `OpenID Connect configuratie voor eHerkenning` om deze te activeren. - Model field type BooleanField Possible values True, False Default value False diff --git a/docs/configuration/zgw.rst b/docs/configuration/zgw.rst index b9b72ce150..1c79bf3c8b 100644 --- a/docs/configuration/zgw.rst +++ b/docs/configuration/zgw.rst @@ -1,10 +1,6 @@ .. _zgw: - -================= -ZGW configuration -================= - +ZGW Configuration Settings Overview ================= @@ -55,71 +51,61 @@ Detailed Information Variable ZGW_CONFIG_ZAAK_MAX_CONFIDENTIALITY Setting Zaak vertrouwelijkheid Description Selecteer de maximale vertrouwelijkheid van de getoonde zaken - Model field type CharField - Possible values string + Possible values openbaar, beperkt_openbaar, intern, zaakvertrouwelijk, vertrouwelijk, confidentieel, geheim, zeer_geheim Default value openbaar Variable ZGW_CONFIG_DOCUMENT_MAX_CONFIDENTIALITY Setting Documenten vertrouwelijkheid Description Selecteer de maximale vertrouwelijkheid van de getoonde documenten van zaken - Model field type CharField - Possible values string + Possible values openbaar, beperkt_openbaar, intern, zaakvertrouwelijk, vertrouwelijk, confidentieel, geheim, zeer_geheim Default value openbaar Variable ZGW_CONFIG_MAX_UPLOAD_SIZE Setting Maximale upload grootte (in MB) Description Documentuploads mogen maximaal dit aantal MB groot zijn, anders worden ze geweigerd. - Model field type PositiveIntegerField - Possible values string representing a (positive) number + Possible values string representing a positive number Default value 50 Variable ZGW_CONFIG_ALLOWED_FILE_EXTENSIONS Setting allowed file extensions Description Een lijst van toegestande bestandsextensies, alleen documentuploads met een van deze extensies worden toegelaten. - Model field type ArrayField Possible values string, comma-delimited ('foo,bar,baz') - Default value No information + Default value ['bmp', 'doc', 'docx', 'gif', 'jpeg', 'jpg', 'msg', 'pdf', 'png', 'ppt', 'pptx', 'rtf', 'tiff', 'txt', 'vsd', 'xls', 'xlsx'] Variable ZGW_CONFIG_SKIP_NOTIFICATION_STATUSTYPE_INFORMEREN Setting Maak gebruik van StatusType.informeren workaround (eSuite) Description Schakel dit in wanneer StatusType.informeren niet wordt ondersteund door de ZGW API waar deze omgeving aan is gekoppeld (zoals de eSuite ZGW API)Hierdoor is het verplicht om per zaaktype aan te geven wanneer een inwoner hier een notificatie van dient te krijgen. - Model field type BooleanField Possible values True, False Default value False Variable ZGW_CONFIG_REFORMAT_ESUITE_ZAAK_IDENTIFICATIE Setting Converteer eSuite zaaknummers Description Schakel dit in om de zaaknummers van het interne eSuite format (ex: '0014ESUITE66392022') om te zetten naar een toegankelijkere notatie ('6639-2022'). - Model field type BooleanField Possible values True, False Default value False Variable ZGW_CONFIG_FETCH_EHERKENNING_ZAKEN_WITH_RSIN Setting Maak gebruik van het RSIN voor ophalen eHerkenning zaken Description Indien ingeschakeld dan wordt het RSIN van eHerkenning gebruikers gebruikt om de zaken op te halen. Indien uitgeschakeld dan wordt het KVK nummer gebruikt om de zaken op te halen. Open Zaak hanteert conform de ZGW API specificatie de RSIN, de eSuite maakt gebruik van het KVK nummer. - Model field type BooleanField Possible values True, False Default value False Variable ZGW_CONFIG_TITLE_TEXT Setting Titel tekst Description De titel/introductietekst getoond op de lijstweergave van 'Mijn aanvragen'. - Model field type TextField Possible values string - Default value No information + Default value Hier vindt u een overzicht van al uw lopende en afgeronde aanvragen. Variable ZGW_CONFIG_ENABLE_CATEGORIES_FILTERING_WITH_ZAKEN Setting Inschakelen gepersonaliseerde Onderwerpen op basis van zaken Description Indien ingeschakeld dan worden (indien ingelogd met DigiD/eHerkenning) de getoonde onderwerpen op de Homepage bepaald op basis van de zaken van de gebruiker - Model field type BooleanField Possible values True, False Default value False Variable ZGW_CONFIG_ACTION_REQUIRED_DEADLINE_DAYS Setting Standaard actie deadline termijn in dagen Description Aantal dagen voor gebruiker om actie te ondernemen. - Model field type IntegerField - Possible values No information available + Possible values string representing a number Default value 15 \ No newline at end of file diff --git a/src/open_inwoner/configurations/bootstrap/constants.py b/src/open_inwoner/configurations/bootstrap/constants.py index 1125db6b58..5d8caa1174 100644 --- a/src/open_inwoner/configurations/bootstrap/constants.py +++ b/src/open_inwoner/configurations/bootstrap/constants.py @@ -1,154 +1,15 @@ -from mozilla_django_oidc_db.models import UserInformationClaimsSources -from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen - -from digid_eherkenning_oidc_generics.models import ( - OpenIDConnectDigiDConfig, - OpenIDConnectEHerkenningConfig, -) -from open_inwoner.configurations.models import SiteConfiguration -from open_inwoner.openklant.models import OpenKlantConfig -from open_inwoner.openzaak.models import ( - OpenZaakConfig, - generate_default_file_extensions, +from open_inwoner.configurations.bootstrap.models import ( + DigiDOIDCConfigurationSettings, + KICConfigurationSettings, + SiteConfigurationSettings, + ZGWConfigurationSettings, + eHerkenningDOIDCConfigurationSettings, ) -from .utils import generate_api_fields_from_template, populate_fields - -CONFIDENTIALITY_LEVELS = [ - choice[0] for choice in VertrouwelijkheidsAanduidingen.choices -] -FILE_EXTENSIONS = [ext for ext in generate_default_file_extensions()] -USER_INFO_CLAIM_SOURCES = [choice[0] for choice in UserInformationClaimsSources.choices] - - -# -# SiteConfiguration -# -require = ( - "name", - "primary_color", - "secondary_color", - "accent_color", -) -exclude = ( - "id", - "email_logo", - "footer_logo", - "favicon", - "openid_connect_logo", - "extra_css", - "logo", - "hero_image_login", - "theme_stylesheet", -) -all_fields = ( - field - for field in SiteConfiguration._meta.concrete_fields - if field.name not in exclude -) -siteconfig_fields = { - "all": [], - "required": [], -} - -populate_fields( - siteconfig_fields, require=require, exclude=exclude, all_fields=all_fields -) - - -# -# KIC config -# -klanten_api_fields = generate_api_fields_from_template("klanten_api") -contactmomenten_api_fields = generate_api_fields_from_template("contactmomenten_api") - -require = ( - "register_type", - "register_contact_moment", - *klanten_api_fields.keys(), - *contactmomenten_api_fields.keys(), -) -exclude = ("id", "klanten_service", "contactmomenten_service") -all_fields = ( - field - for field in OpenKlantConfig._meta.concrete_fields - if field.name not in exclude -) -kic_fields = { - "all": [], - "required": [ - "register_type", - "register_contact_moment", - *klanten_api_fields.keys(), - *contactmomenten_api_fields.keys(), - ], -} -populate_fields(kic_fields, require=None, exclude=exclude, all_fields=all_fields) - - -# -# ZGW config -# -zaak_api_fields = generate_api_fields_from_template("zaak_api") -catalogi_api_fields = generate_api_fields_from_template("catalogi_api") -documenten_api_fields = generate_api_fields_from_template("documenten_api") -formulieren_api_fields = generate_api_fields_from_template("formulieren_api") - -exclude = ("id", "catalogi_service", "document_service", "form_service", "zaak_service") -all_fields = ( - field for field in OpenZaakConfig._meta.concrete_fields if field.name not in exclude -) -zgw_fields = { - "all": [], - "required": [ - *zaak_api_fields.keys(), - *catalogi_api_fields.keys(), - *documenten_api_fields.keys(), - *formulieren_api_fields.keys(), - ], -} - -populate_fields(zgw_fields, require=None, exclude=exclude, all_fields=all_fields) - - -# -# DigiD OIDC -# -exclude = "id" -all_fields = ( - field - for field in OpenIDConnectDigiDConfig._meta.concrete_fields - if field.name not in exclude -) -digid_oidc_fields = { - "all": [], - "required": [ - "oidc_rp_client_id", - "oidc_rp_client_secret", - ], -} - -populate_fields(digid_oidc_fields, require=None, exclude=exclude, all_fields=all_fields) - - -# -# eHerkenning OIDC -# -exclude = "id" -all_fields = ( - field - for field in OpenIDConnectEHerkenningConfig._meta.concrete_fields - if field.name not in exclude -) -eherkenning_oidc_fields = { - "all": [], - "required": [ - "oidc_rp_client_id", - "oidc_rp_client_secret", - ], -} - -populate_fields( - eherkenning_oidc_fields, require=None, exclude=exclude, all_fields=all_fields -) +class ConfigurationMapping: + siteconfig = SiteConfigurationSettings + kic = KICConfigurationSettings + zgw = ZGWConfigurationSettings + digid_oidc = DigiDOIDCConfigurationSettings + eherkenning_oidc = eHerkenningDOIDCConfigurationSettings diff --git a/src/open_inwoner/configurations/bootstrap/models.py b/src/open_inwoner/configurations/bootstrap/models.py index b875ce46b7..8fa9386c4f 100644 --- a/src/open_inwoner/configurations/bootstrap/models.py +++ b/src/open_inwoner/configurations/bootstrap/models.py @@ -1,3 +1,8 @@ +from dataclasses import dataclass +from typing import Any, TypeAlias + +from django.db.models.fields import NOT_PROVIDED + from digid_eherkenning_oidc_generics.models import ( OpenIDConnectDigiDConfig, OpenIDConnectEHerkenningConfig, @@ -6,57 +11,199 @@ from open_inwoner.openklant.models import OpenKlantConfig from open_inwoner.openzaak.models import OpenZaakConfig -from .constants import ( - digid_oidc_fields, - eherkenning_oidc_fields, - kic_fields, - siteconfig_fields, - zgw_fields, +from .utils import generate_api_fields_from_template + +ConfigModel: TypeAlias = ( + SiteConfiguration | OpenKlantConfig | OpenZaakConfig | OpenIDConnectDigiDConfig ) -from .utils import ConfigField + + +@dataclass(frozen=True) +class ConfigField: + name: str + verbose_name: str + description: str + default_value: str + values: str + + +@dataclass +class Fields: + all: list + required: list class ConfigSettingsBase: + model: ConfigModel + required: list[str] + excluded: list[str] + @classmethod def get_setting_name(cls, field: ConfigField | str) -> str: if isinstance(field, str): return f"{cls.namespace}_" + field.upper() return f"{cls.namespace}_" + field.name.upper() - @classmethod - def get_required_settings(cls) -> list[str]: - return [cls.get_setting_name(field) for field in cls.fields["required"]] + @staticmethod + def get_default_value(field: Any) -> str: + default = field.default - @classmethod - def get_config_mapping(cls) -> list[str]: - return {cls.get_setting_name(field): field for field in cls.fields["all"]} + if default is NOT_PROVIDED: + return "No default" + if callable(default): + default = default.__call__() + + return default + + @staticmethod + def get_example_values(field: Any) -> str: + # fields with choices + if choices := field.choices: + values = [choice[0] for choice in choices] + return ", ".join(values) + + # other fields + match field.get_internal_type(): + case "CharField": + return "string" + case "TextField": + return "string" + case "URLField": + return "string (URL)" + case "BooleanField": + return "True, False" + case "IntegerField": + return "string representing a number" + case "PositiveIntegerField": + return "string representing a positive number" + case "ArrayField": + return "string, comma-delimited ('foo,bar,baz')" + case _: + return "No information available" + + def get_model_fields(self): + return ( + field + for field in self.model._meta.concrete_fields + if field.name not in self.__class__.excluded + ) + + def populate_fields( + self, + required: tuple[str], + excluded: tuple[str], + model_fields: list[Any], + ): + for field in model_fields: + config_field = ConfigField( + name=field.name, + verbose_name=field.verbose_name, + description=field.help_text, + default_value=self.get_default_value(field), + values=self.get_example_values(field), + ) + self.fields.all.append(config_field) + if config_field.name in required: + self.fields.required.append(config_field) + + def get_required_settings(self) -> list[str]: + return (self.get_setting_name(field) for field in self.fields.required) + + def get_config_mapping(self) -> list[str]: + return {self.get_setting_name(field): field for field in self.fields.all} + + def __init__(self): + self.fields = Fields(all=[], required=[]) + + self.populate_fields( + required=self.required, + excluded=self.excluded, + model_fields=self.get_model_fields(), + ) class SiteConfigurationSettings(ConfigSettingsBase): model = SiteConfiguration + display_name = "General Configuration" namespace = "SITE" - fields = siteconfig_fields + required = [ + "name", + "primary_color", + "secondary_color", + "accent_color", + ] + excluded = [ + "id", + "email_logo", + "footer_logo", + "favicon", + "openid_connect_logo", + "extra_css", + "logo", + "hero_image_login", + "theme_stylesheet", + ] class KICConfigurationSettings(ConfigSettingsBase): model = OpenKlantConfig + display_name = "Klanten Configuration" namespace = "KIC_CONFIG" - fields = kic_fields + required = [ + "register_type", + "register_contact_moment", + *generate_api_fields_from_template("klanten_api"), + *generate_api_fields_from_template("contactmomenten_api"), + ] + excluded = ["id", "klanten_service", "contactmomenten_service"] + + def __init__(self): + super().__init__() + self.fields.required = self.required class ZGWConfigurationSettings(ConfigSettingsBase): model = OpenZaakConfig + display_name = "ZGW Configuration" namespace = "ZGW_CONFIG" - fields = zgw_fields + required = [ + *generate_api_fields_from_template("zaak_api"), + *generate_api_fields_from_template("catalogi_api"), + *generate_api_fields_from_template("documenten_api"), + *generate_api_fields_from_template("formulieren_api"), + ] + excluded = [ + "id", + "catalogi_service", + "document_service", + "form_service", + "zaak_service", + ] + + def __init__(self): + super().__init__() + self.fields.required = self.required class DigiDOIDCConfigurationSettings(ConfigSettingsBase): model = OpenIDConnectDigiDConfig + display_name = "DIGID OIDC Configuration" namespace = "DIGID_OIDC" - fields = digid_oidc_fields + required = ["oidc_rp_client_id", "oidc_rp_client_secret"] + excluded = "id" + + def __init__(self): + super().__init__() + self.fields.required = self.required class eHerkenningDOIDCConfigurationSettings(ConfigSettingsBase): model = OpenIDConnectEHerkenningConfig + display_name = "eHerkenning OIDC Configuration" namespace = "EHERKENNING_OIDC" - fields = eherkenning_oidc_fields + required = ["oidc_rp_client_id", "oidc_rp_client_secret"] + excluded = "id" + + def __init__(self): + super().__init__() + self.fields.required = self.required diff --git a/src/open_inwoner/configurations/bootstrap/siteconfig.py b/src/open_inwoner/configurations/bootstrap/siteconfig.py index 48e4b7d877..277abf036a 100644 --- a/src/open_inwoner/configurations/bootstrap/siteconfig.py +++ b/src/open_inwoner/configurations/bootstrap/siteconfig.py @@ -16,8 +16,9 @@ class SiteConfigurationStep(BaseConfigurationStep): def is_configured(self): config = SiteConfiguration.get_solo() - required_settings = SiteConfigurationSettings.get_required_settings() - setting_to_config = SiteConfigurationSettings.get_config_mapping() + config_settings = SiteConfigurationSettings() + required_settings = config_settings.get_required_settings() + setting_to_config = config_settings.get_config_mapping() for required_setting in required_settings: config_field = setting_to_config[required_setting] @@ -27,7 +28,8 @@ def is_configured(self): def configure(self): config = SiteConfiguration.get_solo() - setting_to_config = SiteConfigurationSettings.get_config_mapping() + config_settings = SiteConfigurationSettings() + setting_to_config = config_settings.get_config_mapping() for setting_name, config_field in setting_to_config.items(): setting = getattr(settings, setting_name) diff --git a/src/open_inwoner/configurations/bootstrap/templates/base.rst.template b/src/open_inwoner/configurations/bootstrap/templates/config_doc.rst similarity index 82% rename from src/open_inwoner/configurations/bootstrap/templates/base.rst.template rename to src/open_inwoner/configurations/bootstrap/templates/config_doc.rst index 1dacbacd87..85b51f336b 100644 --- a/src/open_inwoner/configurations/bootstrap/templates/base.rst.template +++ b/src/open_inwoner/configurations/bootstrap/templates/config_doc.rst @@ -1,6 +1,6 @@ -{% block link %}{% endblock %} +{% block link %}{{ link }}{% endblock %} -{% block title %}{% endblock %} +{% block title %}{{ display_name }}{% endblock %} Settings Overview ================= diff --git a/src/open_inwoner/configurations/bootstrap/templates/digid_oidc.rst.template b/src/open_inwoner/configurations/bootstrap/templates/digid_oidc.rst.template deleted file mode 100644 index 510ff21fbb..0000000000 --- a/src/open_inwoner/configurations/bootstrap/templates/digid_oidc.rst.template +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.rst.template" %} - -{% block link -%} -.. _digid_oidc: -{% endblock -%} - -{% block title -%} -======================== -DigiD OIDC configuration -======================== -{% endblock %} diff --git a/src/open_inwoner/configurations/bootstrap/templates/eherkenning_oidc.rst.template b/src/open_inwoner/configurations/bootstrap/templates/eherkenning_oidc.rst.template deleted file mode 100644 index 5c491ef480..0000000000 --- a/src/open_inwoner/configurations/bootstrap/templates/eherkenning_oidc.rst.template +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.rst.template" %} - -{% block link -%} -.. _eherkenning_oidc: -{% endblock -%} - -{% block title -%} -======================== -eHerkenning OIDC configuration -======================== -{% endblock %} diff --git a/src/open_inwoner/configurations/bootstrap/templates/kic.rst.template b/src/open_inwoner/configurations/bootstrap/templates/kic.rst.template deleted file mode 100644 index 191690831b..0000000000 --- a/src/open_inwoner/configurations/bootstrap/templates/kic.rst.template +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.rst.template" %} - -{% block link -%} -.. _kic: -{% endblock -%} - -{% block title -%} -===================== -Klanten configuration -===================== -{% endblock %} diff --git a/src/open_inwoner/configurations/bootstrap/templates/siteconfig.rst.template b/src/open_inwoner/configurations/bootstrap/templates/siteconfig.rst.template deleted file mode 100644 index 154dbdb071..0000000000 --- a/src/open_inwoner/configurations/bootstrap/templates/siteconfig.rst.template +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.rst.template" %} - -{% block link -%} -.. _siteconfig: -{% endblock -%} - -{% block title -%} -===================== -General configuration -===================== -{% endblock %} diff --git a/src/open_inwoner/configurations/bootstrap/templates/zgw.rst.template b/src/open_inwoner/configurations/bootstrap/templates/zgw.rst.template deleted file mode 100644 index d718a1cda0..0000000000 --- a/src/open_inwoner/configurations/bootstrap/templates/zgw.rst.template +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.rst.template" %} - -{% block link -%} -.. _zgw: -{% endblock -%} - -{% block title -%} -================= -ZGW configuration -================= -{% endblock %} diff --git a/src/open_inwoner/configurations/bootstrap/typing.py b/src/open_inwoner/configurations/bootstrap/typing.py new file mode 100644 index 0000000000..b85784d7fc --- /dev/null +++ b/src/open_inwoner/configurations/bootstrap/typing.py @@ -0,0 +1,11 @@ +from typing import TypeAlias + +from open_inwoner.configurations.bootstrap.constants import ConfigurationMapping + +ConfigSetting: TypeAlias = ( + ConfigurationMapping.siteconfig + | ConfigurationMapping.kic + | ConfigurationMapping.zgw + | ConfigurationMapping.digid_oidc + | ConfigurationMapping.eherkenning_oidc +) diff --git a/src/open_inwoner/configurations/bootstrap/utils.py b/src/open_inwoner/configurations/bootstrap/utils.py index 4e94574d14..985158d5b1 100644 --- a/src/open_inwoner/configurations/bootstrap/utils.py +++ b/src/open_inwoner/configurations/bootstrap/utils.py @@ -1,68 +1,3 @@ -from dataclasses import dataclass -from typing import Any, Iterator - -from django.db.models.fields import NOT_PROVIDED - - -@dataclass(frozen=True) -class ConfigField: - name: str - verbose_name: str - description: str - field_type: str - default_value: str - values: str - - -def populate_fields( - fields: dict[str, list], - require: tuple[str], - exclude: tuple[str], - all_fields: Iterator, -): - for field in all_fields: - config_field = ConfigField( - name=field.name, - verbose_name=field.verbose_name, - description=field.description, - field_type=field.get_internal_type(), - default_value=get_default_value(field), - values=get_example_value(field), - ) - fields["all"].append(config_field) - if require and config_field.name in require: - fields["required"].append(config_field) - - -def get_default_value(field: Any) -> str: - default = field.default - - if default is NOT_PROVIDED: - return "No default" - if not isinstance(default, (str, bool, int)): - return "No information" - - return default - - -def get_example_value(field: Any) -> str: - match field.get_internal_type(): - case "CharField": - return "string" - case "TextField": - return "string" - case "URLField": - return "string (URL)" - case "BooleanField": - return "True, False" - case "PositiveIntegerField": - return "string representing a (positive) number" - case "ArrayField": - return "string, comma-delimited ('foo,bar,baz')" - case _: - return "No information available" - - def generate_api_fields_from_template(api_name: str) -> dict[str, str]: name = api_name.split("_")[0].capitalize() diff --git a/src/open_inwoner/configurations/management/commands/generate_config_docs.py b/src/open_inwoner/configurations/management/commands/generate_config_docs.py index be72f62a4f..878f5cb381 100644 --- a/src/open_inwoner/configurations/management/commands/generate_config_docs.py +++ b/src/open_inwoner/configurations/management/commands/generate_config_docs.py @@ -1,28 +1,13 @@ import os from pathlib import Path -from typing import TypeAlias from django.conf import settings from django.core.management.base import BaseCommand -from jinja2 import Environment, FileSystemLoader, select_autoescape - -from open_inwoner.configurations.bootstrap.models import ( - DigiDOIDCConfigurationSettings, - KICConfigurationSettings, - SiteConfigurationSettings, - ZGWConfigurationSettings, - eHerkenningDOIDCConfigurationSettings, -) - -ConfigSetting: TypeAlias = ( - DigiDOIDCConfigurationSettings - | KICConfigurationSettings - | SiteConfigurationSettings - | ZGWConfigurationSettings - | eHerkenningDOIDCConfigurationSettings -) +from jinja2 import Environment, FileSystemLoader +from open_inwoner.configurations.bootstrap.constants import ConfigurationMapping +from open_inwoner.configurations.bootstrap.typing import ConfigSetting SUPPORTED_OPTIONS = ["siteconfig", "kic", "zgw", "digid_oidc", "eherkenning_oidc"] @@ -31,6 +16,7 @@ / "bootstrap" / "templates" ) +TEMPLATE_PATH = TEMPLATE_DIR / "config_doc.rst" TARGET_DIR = Path(settings.BASE_DIR) / "docs" / "configuration" @@ -41,24 +27,17 @@ def add_arguments(self, parser): parser.add_argument("config_option", nargs="?") def get_config(self, config_option: str) -> dict[str, ConfigSetting]: - mapping = { - "siteconfig": SiteConfigurationSettings, - "kic": KICConfigurationSettings, - "zgw": ZGWConfigurationSettings, - "digid_oidc": DigiDOIDCConfigurationSettings, - "eherkenning_oidc": eHerkenningDOIDCConfigurationSettings, - } - return mapping[config_option] + config_model = getattr(ConfigurationMapping, config_option, None) + config_instance = config_model() + return config_instance def get_detailed_info(self, config: ConfigSetting) -> list[str]: ret = [] - for field in config.fields["all"]: - model_field = config.model._meta.get_field(field.name) + for field in config.fields.all: part = [] part.append(f"{'Variable':<20}{config.get_setting_name(field)}") - part.append(f"{'Setting':<20}{str(model_field.verbose_name)}") - part.append(f"{'Description':<20}{str(model_field.help_text)}") - part.append(f"{'Model field type':<20}{field.field_type}") + part.append(f"{'Setting':<20}{field.verbose_name}") + part.append(f"{'Description':<20}{field.description}") part.append(f"{'Possible values':<20}{field.values}") part.append(f"{'Default value':<20}{field.default_value}") ret.append(part) @@ -73,7 +52,7 @@ def write_file_from_template( with open(template_path, "r") as template: template_str = template.read() template = Environment( - loader=FileSystemLoader(TEMPLATE_DIR), autoescape=select_autoescape() + loader=FileSystemLoader(TEMPLATE_DIR), autoescape=False ).from_string(template_str) rendered = template.render(template_variables) @@ -84,21 +63,21 @@ def generate_single_doc(self, config_option: str) -> None: config = self.get_config(config_option) required_settings = [ - config.get_setting_name(field) for field in config.fields["required"] + config.get_setting_name(field) for field in config.fields.required ] required_settings.sort() - all_settings = [ - config.get_setting_name(field) for field in config.fields["all"] - ] + all_settings = [config.get_setting_name(field) for field in config.fields.all] all_settings.sort() detailed_info = self.get_detailed_info(config) template_variables = { + "display_name": config.display_name, + "link": f".. _{config_option}:", "required_settings": required_settings, "all_settings": all_settings, "detailed_info": detailed_info, } - template_path = TEMPLATE_DIR / f"{config_option}.rst.template" + template_path = TEMPLATE_PATH output_path = TARGET_DIR / f"{config_option}.rst" self.write_file_from_template(template_path, template_variables, output_path) @@ -107,6 +86,8 @@ def handle(self, *args, **kwargs) -> None: config_option = kwargs["config_option"] if config_option and config_option not in SUPPORTED_OPTIONS: + self.stdout.write(f"Unsupported config option ({config_option})\n") + self.stdout.write(f"Supported: {', '.join(SUPPORTED_OPTIONS)}") return elif config_option: self.generate_single_doc(config_option)