diff --git a/docs/config/settings.md b/docs/config/settings.md index 67ed970a..fc32fa3a 100644 --- a/docs/config/settings.md +++ b/docs/config/settings.md @@ -144,6 +144,12 @@ Should uMap allows user without an account to create maps (default is False). Can be set through env var: `UMAP_ALLOW_ANONYMOUS=1` +#### UMAP_ALLOW_EDIT_PROFILE + +Should uMap allows users to edit their profile (default is True). + +Can be unset through env var: `UMAP_ALLOW_EDIT_PROFILE=0` + #### UMAP_CUSTOM_TEMPLATES To be used when you want to override some HTML templates: diff --git a/umap/context_processors.py b/umap/context_processors.py index 735f759a..1d214a40 100644 --- a/umap/context_processors.py +++ b/umap/context_processors.py @@ -12,6 +12,7 @@ def settings(request): "UMAP_READONLY": djsettings.UMAP_READONLY, "UMAP_DEMO_SITE": djsettings.UMAP_DEMO_SITE, "UMAP_HOST_INFOS": djsettings.UMAP_HOST_INFOS, + "UMAP_ALLOW_EDIT_PROFILE": djsettings.UMAP_ALLOW_EDIT_PROFILE, } diff --git a/umap/settings/base.py b/umap/settings/base.py index 5123ddae..1e1eda73 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -240,6 +240,7 @@ USER_URL_FIELD = "username" # Miscellaneous project settings # ============================================================================= UMAP_ALLOW_ANONYMOUS = env.bool("UMAP_ALLOW_ANONYMOUS", default=False) +UMAP_ALLOW_EDIT_PROFILE = env.bool("UMAP_ALLOW_EDIT_PROFILE", default=True) UMAP_EXTRA_URLS = { "routing": "http://www.openstreetmap.org/directions?engine=osrm_car&route={lat},{lng}&locale={locale}#map={zoom}/{lat}/{lng}", # noqa diff --git a/umap/templates/umap/dashboard_menu.html b/umap/templates/umap/dashboard_menu.html index ac07420f..a7da6306 100644 --- a/umap/templates/umap/dashboard_menu.html +++ b/umap/templates/umap/dashboard_menu.html @@ -7,8 +7,10 @@ {% else %} {% trans "My Maps" %} {% endif %} - {% trans "My profile" %} + {% if UMAP_ALLOW_EDIT_PROFILE %} + {% trans "My profile" %} + {% endif %} {% trans "My teams" %} diff --git a/umap/urls.py b/umap/urls.py index df2de682..aaab2beb 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -115,11 +115,15 @@ i18n_urls += decorated_patterns( name="map_star", ), path("me", views.user_dashboard, name="user_dashboard"), - path("me/profile", views.user_profile, name="user_profile"), path("me/download", views.user_download, name="user_download"), path("me/teams", views.UserTeams.as_view(), name="user_teams"), path("team/create/", views.TeamNew.as_view(), name="team_new"), ) + +if settings.UMAP_ALLOW_EDIT_PROFILE: + i18n_urls.append( + path("me/profile", login_required(views.user_profile), name="user_profile") + ) i18n_urls += decorated_patterns( [login_required, team_members_only], path("team//edit/", views.TeamUpdate.as_view(), name="team_update"),