=== modified file 'lava_server/context_processors.py'
@@ -47,7 +47,7 @@
lava_server.__version__, hint=lava_server)}}
def openid_available(request):
- openid_enabled = "django_openid_auth.auth.OpenIDBackend" in lava_server.settings.common.AUTHENTICATION_BACKENDS
+ openid_enabled = "django_openid_auth.auth.OpenIDBackend" in settings.AUTHENTICATION_BACKENDS
# Check if we use generic OpenID or Launchpad.net
openid_url = getattr(settings, "OPENID_SSO_SERVER_URL", "")
if "ubuntu.com" in openid_url or "launchpad.net" in openid_url:
=== modified file 'lava_server/settings/common.py'
@@ -1,4 +1,4 @@
-# Copyright (C) 2010, 2011 Linaro Limited
+# Copyright (C) 2010-2013 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
@@ -16,7 +16,15 @@
# You should have received a copy of the GNU Affero General Public License
# along with LAVA Server. If not, see <http://www.gnu.org/licenses/>.
-import lava_server.settings.crowd as crowd
+
+# WARNING:
+# Never edit this file on a production system!
+# Any changes can be overwritten at any time by upgrade or any
+# system management operation. All production config changes
+# should happen strictly to etc/settings.conf, etc. files.
+# All comments below are strictly for development usage and
+# reference.
+
# Administrator contact, used for sending
# emergency email when something breaks
@@ -124,13 +132,6 @@
'google_analytics',
]
-if crowd.enabled:
- try:
- import crowdrest
- INSTALLED_APPS.append('crowdrest')
- except ImportError:
- pass
-
try:
import devserver
INSTALLED_APPS += ['devserver']
@@ -166,13 +167,6 @@
from openid import oidutil
oidutil.log = lambda msg, level=0: None
-# Configuration settings for crowdrest.backend.CrowdRestBackend
-# Alternatively, can be set in production config for particular installed
-# instance.
-AUTH_CROWD_APPLICATION_USER = crowd.settings.get('username', 'appname')
-AUTH_CROWD_APPLICATION_PASSWORD = crowd.settings.get('password', 'apppass')
-AUTH_CROWD_SERVER_REST_URI = crowd.settings.get('apiurl', 'https://crowd-server/crowd/rest/usermanagement/1')
-
RESTRUCTUREDTEXT_FILTER_SETTINGS = {"initial_header_level": 4}
# Add google analytics model.
=== removed file 'lava_server/settings/crowd.py'
@@ -1,24 +0,0 @@
-import os
-import yaml
-
-search_path = [
- '/etc/lava-server/crowd.yaml'
-]
-
-if "VIRTUAL_ENV" in os.environ:
- search_path.insert(0, os.path.join(os.environ["VIRTUAL_ENV"],
- 'etc/lava-server/crowd.yaml'))
-
-config_file = None
-
-for f in search_path:
- if os.path.exists(f):
- config_file = f
- break
-
-enabled = (config_file is not None)
-
-settings = {}
-
-if config_file:
- settings = yaml.load(open(config_file))
=== modified file 'lava_server/settings/debian.py'
@@ -87,6 +87,22 @@
OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO = False
OPENID_LAUNCHPAD_TEAMS_MAPPING = debian_settings.get_setting("OPENID_LAUNCHPAD_TEAMS_MAPPING")
+# Atlassian Crowd authentication config
+AUTH_CROWD_SERVER_REST_URI = debian_settings.get_setting("AUTH_CROWD_SERVER_REST_URI")
+if AUTH_CROWD_SERVER_REST_URI:
+ # If Crowd server URL is configured, disable OpenID and
+ # enable Crowd auth backend
+ INSTALLED_APPS.append('crowdrest')
+ AUTHENTICATION_BACKENDS = ['crowdrest.backend.CrowdRestBackend'] + \
+ [x for x in AUTHENTICATION_BACKENDS if "OpenID" not in x]
+
+ # Load credentials from a separate file
+ from django_debian.config_file import ConfigFile
+ pathname = debian_settings._get_pathname("crowd")
+ crowd_config = ConfigFile.load(pathname)
+ AUTH_CROWD_APPLICATION_USER = crowd_config.AUTH_CROWD_APPLICATION_USER
+ AUTH_CROWD_APPLICATION_PASSWORD = crowd_config.AUTH_CROWD_APPLICATION_PASSWORD
+
# Load extensions
loader.contribute_to_settings(locals(), debian_settings)