Skip to content

Commit da49280

Browse files
committed
Merge branch 'develop'
2 parents c0af3d1 + e6087d5 commit da49280

File tree

5 files changed

+85
-17
lines changed

5 files changed

+85
-17
lines changed

boot.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ if [ -z "${SECRET_KEY}" ]; then
2929
display_warning "The environment variable 'SECRET_KEY' (or 'SECRET_KEY_FILE' that points to an existing file) is not set but REQUIRED for running Tandoor!"
3030
fi
3131

32+
if [ -f "${AUTH_LDAP_BIND_PASSWORD_FILE}" ]; then
33+
export AUTH_LDAP_BIND_PASSWORD=$(cat "$AUTH_LDAP_BIND_PASSWORD_FILE")
34+
fi
35+
36+
if [ -f "${EMAIL_HOST_PASSWORD_FILE}" ]; then
37+
export EMAIL_HOST_PASSWORD=$(cat "$EMAIL_HOST_PASSWORD_FILE")
38+
fi
39+
40+
if [ -f "${SOCIALACCOUNT_PROVIDERS_FILE}" ]; then
41+
export SOCIALACCOUNT_PROVIDERS=$(cat "$SOCIALACCOUNT_PROVIDERS_FILE")
42+
fi
43+
3244

3345
echo "Waiting for database to be ready..."
3446

@@ -83,4 +95,4 @@ if [ "$ipv6_disable" -eq 0 ]; then
8395
exec gunicorn -b "[::]:$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
8496
else
8597
exec gunicorn -b ":$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
86-
fi
98+
fi

cookbook/helper/template_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import bleach
44
import markdown as md
55
from jinja2 import Template, TemplateSyntaxError, UndefinedError
6+
from jinja2.exceptions import SecurityError
7+
from jinja2.sandbox import SandboxedEnvironment
68
from markdown.extensions.tables import TableExtension
79

810
from cookbook.helper.mdx_attributes import MarkdownFormatExtension
@@ -89,11 +91,13 @@ def scale(number):
8991
return f"<scalable-number v-bind:number='{bleach.clean(str(number))}' v-bind:factor='ingredient_factor'></scalable-number>"
9092

9193
try:
92-
template = Template(instructions)
93-
instructions = template.render(ingredients=ingredients, scale=scale)
94+
env = SandboxedEnvironment()
95+
instructions = env.from_string(instructions).render(ingredients=ingredients, scale=scale)
9496
except TemplateSyntaxError:
9597
return _('Could not parse template code.') + ' Error: Template Syntax broken'
9698
except UndefinedError:
9799
return _('Could not parse template code.') + ' Error: Undefined Error'
100+
except SecurityError:
101+
return _('Could not parse template code.') + ' Error: Security Error'
98102

99103
return instructions

docs/features/authentication.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Besides the normal django username and password authentication this application supports multiple
1+
Besides the normal django username and password authentication this application supports multiple
22
methods of central account management and authentication.
33

44
## Allauth
5-
[Django Allauth](https://django-allauth.readthedocs.io/en/latest/index.html) is an awesome project that
5+
[Django Allauth](https://django-allauth.readthedocs.io/en/latest/index.html) is an awesome project that
66
allows you to use a [huge number](https://docs.allauth.org/en/latest/socialaccount/providers/index.html) of different
77
authentication providers.
88

@@ -11,8 +11,8 @@ They basically explain everything in their documentation, but the following is a
1111
!!! warning "Public Providers"
1212
If you choose Google, Github or any other publicly available service as your authentication provider anyone
1313
with an account on that site can create an account on your installation.
14-
A new account does not have any permission but it is still **not recommended** to give public access to
15-
your installation.
14+
A new account does not have any permission but it is still **not recommended** to give public access to
15+
your installation.
1616

1717
Choose a provider from the [list](https://docs.allauth.org/en/latest/socialaccount/providers/index.html) and install it using the environment variable `SOCIAL_PROVIDERS` as shown
1818
in the example below.
@@ -28,15 +28,15 @@ SOCIAL_PROVIDERS=allauth.socialaccount.providers.openid_connect,allauth.socialac
2828

2929
### Configuration, via environment
3030

31-
Depending on your authentication provider you **might need** to configure it.
32-
This needs to be done through the settings system. To make the system flexible (allow multiple providers) and to
31+
Depending on your authentication provider you **might need** to configure it.
32+
This needs to be done through the settings system. To make the system flexible (allow multiple providers) and to
3333
not require another file to be mounted into the container the configuration ins done through a single
3434
environment variable. The downside of this approach is that the configuration needs to be put into a single line
3535
as environment files loaded by docker compose don't support multiple lines for a single variable.
3636

3737
The line data needs to either be in json or as Python dictionary syntax.
3838

39-
Take the example configuration from the allauth docs, fill in your settings and then inline the whole object
39+
Take the example configuration from the allauth docs, fill in your settings and then inline the whole object
4040
(you can use a service like [www.freeformatter.com](https://www.freeformatter.com/json-formatter.html) for formatting).
4141
Assign it to the additional `SOCIALACCOUNT_PROVIDERS` variable.
4242

@@ -46,6 +46,13 @@ The example below is for a generic OIDC provider with PKCE enabled. Most values
4646
SOCIALACCOUNT_PROVIDERS = "{ 'openid_connect': { 'OAUTH_PKCE_ENABLED': True, 'APPS': [ { 'provider_id': 'oidc', 'name': 'My-IDM', 'client_id': 'my_client_id', 'secret': 'my_client_secret', 'settings': { 'server_url': 'https://idm.example.com/oidc/recipes' } } ] } }"
4747
```
4848

49+
Because this JSON contains sensitive data (client id and secret), you may instead choose to save the JSON in a file
50+
and set the environment variable `SOCIALACCOUNT_PROVIDERS_FILE` to the path of the file containing the JSON.
51+
52+
```
53+
SOCIALACCOUNT_PROVIDERS_FILE=/run/secrets/socialaccount_providers.txt
54+
```
55+
4956
!!! success "Improvements ?"
5057
There are most likely ways to achieve the same goal but with a cleaner or simpler system.
5158
If you know such a way feel free to let me know.
@@ -81,7 +88,7 @@ SOCIALACCOUNT_PROVIDERS='{"openid_connect":{"APPS":[{"provider_id":"keycloak","n
8188
You are now able to sign in using Keycloak after a restart of the service.
8289

8390
### Linking accounts
84-
To link an account to an already existing normal user go to the settings page of the user and link it.
91+
To link an account to an already existing normal user go to the settings page of the user and link it.
8592
Here you can also unlink your account if you no longer want to use a social login method.
8693

8794
## LDAP
@@ -111,7 +118,7 @@ AUTH_LDAP_TLS_CACERTFILE=/etc/ssl/certs/own-ca.pem
111118
If you just set `REMOTE_USER_AUTH=1` without any additional configuration, _anybody_ can authenticate with _any_ username!
112119

113120
!!! Info "Community Contributed Tutorial"
114-
This tutorial was provided by a community member. We are not able to provide any support! Please only use, if you know what you are doing!
121+
This tutorial was provided by a community member. We are not able to provide any support! Please only use, if you know what you are doing!
115122

116123
In order use external authentication (i.e. using a proxy auth like Authelia, Authentik, etc.) you will need to:
117124

docs/system/configuration.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount
354354
Allow authentication via the REMOTE-USER header (can be used for e.g. authelia).
355355

356356
!!! danger
357-
Leave off if you don't know what you are doing! Enabling this without proper configuration will enable anybody
357+
Leave off if you don't know what you are doing! Enabling this without proper configuration will enable anybody
358358
to login with any username!
359359

360360
```
@@ -377,6 +377,14 @@ AUTH_LDAP_TLS_CACERTFILE=
377377
AUTH_LDAP_START_TLS=
378378
```
379379

380+
Instead of passing the LDAP password directly through the environment variable `AUTH_LDAP_BIND_PASSWORD`,
381+
you can set the password in a file and set the environment variable `AUTH_LDAP_BIND_PASSWORD_FILE`
382+
to the path of the file containing the ldap secret.
383+
384+
```
385+
AUTH_LDAP_BIND_PASSWORD_FILE=/run/secrets/ldap_password.txt
386+
```
387+
380388
### External Services
381389

382390
#### Email
@@ -396,6 +404,14 @@ EMAIL_USE_SSL=0
396404
DEFAULT_FROM_EMAIL=
397405
```
398406

407+
Instead of passing the email password directly through the environment variable `EMAIL_HOST_PASSWORD`,
408+
you can set the password in a file and set the environment variable `EMAIL_HOST_PASSWORD_FILE`
409+
to the path of the file containing the ldap secret.
410+
411+
```
412+
EMAIL_HOST_PASSWORD_FILE=/run/secrets/email_password.txt
413+
```
414+
399415
Optional settings (only copy the ones you need)
400416

401417
```
@@ -561,7 +577,7 @@ STICKY_NAV_PREF_DEFAULT=1
561577

562578
> default `100` - options: `0-X`
563579
564-
The default for the number of spaces a user can own. By setting to 0 space creation for users will be disabled.
580+
The default for the number of spaces a user can own. By setting to 0 space creation for users will be disabled.
565581
Superusers can always bypass this limit.
566582

567583
```
@@ -586,7 +602,7 @@ TZ=Europe/Berlin
586602
#### Default Theme
587603
> default `0` - options `1-X` (space ID)
588604
589-
Tandoors appearance can be changed on a user and space level but unauthenticated users always see the tandoor default style.
605+
Tandoors appearance can be changed on a user and space level but unauthenticated users always see the tandoor default style.
590606
With this setting you can specify the ID of a space of which the appearance settings should be applied if a user is not logged in.
591607

592608
```
@@ -633,7 +649,7 @@ DRF_THROTTLE_RECIPE_URL_IMPORT=60/hour
633649

634650
#### Default Space Limits
635651
You might want to limit how many resources a user might create. The following settings apply automatically to newly
636-
created spaces. These defaults can be changed in the admin view after a space has been created.
652+
created spaces. These defaults can be changed in the admin view after a space has been created.
637653

638654
If unset, all settings default to unlimited/enabled
639655

vue/src/locales/da.json

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,5 +539,34 @@
539539
"err_importing_recipe": "Der opstod en fejl under importeringen af opskriften!",
540540
"Properties_Food_Amount": "Egenskaber Ingrediens Mængde",
541541
"FDC_Search": "FDC søgning",
542-
"Calculator": "Lommeregner"
542+
"Calculator": "Lommeregner",
543+
"Undo": "Fortryd",
544+
"NoMoreUndo": "Ingen ændringer at fortryde.",
545+
"Input": "Input",
546+
"Delete_All": "Slet alle",
547+
"CustomNavLogoHelp": "Upload et billede til brug som navigationsbarrelogo.",
548+
"ShowRecentlyCompleted": "Vis nyligt gennemførte emner",
549+
"ShoppingBackgroundSyncWarning": "Dårligt netværk, afventer synkronisering ...",
550+
"CustomTheme": "Personaliseret tema",
551+
"CustomThemeHelp": "Overskriv det valgte temas stil ved at uploade en personlig CSS-fil.",
552+
"property_type_fdc_hint": "Kun egenskabstyper med et FDC ID kan automatisk trække data fra FDC databasen",
553+
"Property_Editor": "Egenskabsredaktør",
554+
"us_cup": "cup (US, volumen)",
555+
"Show_Logo_Help": "Vis Tandoor eller område-logo i navigationsbarre.",
556+
"Nav_Text_Mode": "Navigation textmodus",
557+
"Nav_Text_Mode_Help": "Opfører sig forskelligt for hvert tema.",
558+
"Shopping_input_placeholder": "Fx kartoffel/100 kartofler/100g kartofler",
559+
"CustomImageHelp": "Upload et billede for at vise dets plade i område-oversigten.",
560+
"CustomLogoHelp": "Upload kvadratiske billeder i forskellige størrelser for at ændre logoet i browser-faneblad og installeret web-app.",
561+
"CustomLogos": "Personlige logoer",
562+
"Updated": "Opdateret",
563+
"Unchanged": "Uændret",
564+
"Error": "Fejl",
565+
"Logo": "Logo",
566+
"Show_Logo": "Vis logo",
567+
"Space_Cosmetic_Settings": "Visse kosmetiske indstillinger kan ændres af område-administratorer og vil overskrive klient-indstillinger for pågældende område.",
568+
"Enable": "Aktiver",
569+
"created_by": "Skabt af",
570+
"Created": "Skabt",
571+
"DefaultPage": "Startside"
543572
}

0 commit comments

Comments
 (0)