From 8c1d559e453a61f59cb7078425222bce7729f5b1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 16 2015 16:22:10 +0000 Subject: Add a configuration key to globally disable creating projects --- diff --git a/pagure/default_config.py b/pagure/default_config.py index 38ad853..11ba951 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -37,6 +37,9 @@ APP_URL = 'https://pagure.org/' # Enables / Disables tickets for project for the entire pagure instance ENABLE_TICKETS = True +# Enables / Disables creating projects on this pagure instance +ENABLE_NEW_PROJECTS = True + # The URL to use to clone the git repositories. GIT_URL_SSH = 'ssh://git@pagure.org/' GIT_URL_GIT = 'git://pagure.org/' diff --git a/pagure/templates/master.html b/pagure/templates/master.html index 48f83cb..9cc7754 100644 --- a/pagure/templates/master.html +++ b/pagure/templates/master.html @@ -41,11 +41,13 @@ Admin {% endif %} + {% if config.get('ENABLE_NEW_PROJECTS', True) %}
  • New project
  • + {% endif %} diff --git a/pagure/ui/app.py b/pagure/ui/app.py index 13c7ab7..60e8439 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -228,6 +228,9 @@ def view_user(username): def new_project(): """ Form to create a new project. """ + if not pagure.APP.config.get('ENABLE_NEW_PROJECTS', True): + flask.abort(404) + form = pagure.forms.ProjectForm() if form.validate_on_submit(): name = form.name.data