From 0a4b8a6a34ce6f46168e695f577d9d4500c8b12a Mon Sep 17 00:00:00 2001 From: Ken Raffenetti Date: Fri, 10 Nov 2006 22:10:23 +0000 Subject: made hostbase settings and views more generic for generic installations git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2483 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Hostbase/hostbase/views.py | 41 +++++--------- src/lib/Server/Hostbase/settings.py | 92 ++++++++++++------------------- 2 files changed, 50 insertions(+), 83 deletions(-) (limited to 'src') diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index dd777eea6..abb3adf6f 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -872,29 +872,18 @@ def zonenew(request): 'logged_in': request.session.get('_auth_user_id', False) }) -if settings.CFG_TYPE == 'environ': - #login required stuff - search = login_required(search) - look = login_required(look) - dns = login_required(dns) - gethostdata = login_required(gethostdata) - fill = login_required(fill) - edit = login_required(edit) - confirm = login_required(confirm) - dnsedit = login_required(dnsedit) - new = login_required(new) - remove = login_required(remove) - validate = login_required(validate) - zones = login_required(zones) - zoneview = login_required(zoneview) - zoneedit = login_required(zoneedit) - zonenew = login_required(zonenew) - -else: - edit = login_required(edit) - confirm = login_required(confirm) - dnsedit = login_required(dnsedit) - new = login_required(new) - remove = login_required(remove) - zoneedit = login_required(zoneedit) - zonenew = login_required(zonenew) +## login required stuff +## uncomment the views below that you would like to restrict access to + +## search = login_required(search) +## look = login_required(look) +## dns = login_required(dns) +## edit = login_required(edit) +## confirm = login_required(confirm) +## dnsedit = login_required(dnsedit) +## new = login_required(new) +## remove = login_required(remove) +## zones = login_required(zones) +## zoneview = login_required(zoneview) +## zoneedit = login_required(zoneedit) +## zonenew = login_required(zonenew) diff --git a/src/lib/Server/Hostbase/settings.py b/src/lib/Server/Hostbase/settings.py index 45e54255b..22b755b21 100644 --- a/src/lib/Server/Hostbase/settings.py +++ b/src/lib/Server/Hostbase/settings.py @@ -5,68 +5,46 @@ ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS -CFG_TYPE = 'mcs' -if CFG_TYPE == 'mcs': - # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. - DATABASE_ENGINE = 'mysql' - # Or path to database file if using sqlite3. - DATABASE_NAME = 'hosttest' - # Not used with sqlite3. - DATABASE_USER = 'hosttest' - # Not used with sqlite3. - DATABASE_PASSWORD = 'marathon' - # Set to empty string for localhost. Not used with sqlite3. - DATABASE_HOST = 'mysql.mcs.anl.gov' - # Set to empty string for default. Not used with sqlite3. - DATABASE_PORT = '3306' - # Local time zone for this installation. All choices can be found here: - # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE - TIME_ZONE = 'America/Chicago' +# 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. +DATABASE_ENGINE = '' +# Or path to database file if using sqlite3. +DATABASE_NAME = '' +# Not used with sqlite3. +DATABASE_USER = '' +# Not used with sqlite3. +DATABASE_PASSWORD = '' +# Set to empty string for localhost. Not used with sqlite3. +DATABASE_HOST = '' +# Set to empty string for default. Not used with sqlite3. +DATABASE_PORT = '' +# Local time zone for this installation. All choices can be found here: +# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE +TIME_ZONE = '' - DEFAULT_MX = 'mailgw.mcs.anl.gov' - PRIORITY = 30 +# enter the defauly MX record machines will get in Hostbase +# this setting may move elsewhere eventually +DEFAULT_MX = 'mailserver.somewhere.com' +PRIORITY = 30 - SESSION_EXPIRE_AT_BROWSER_CLOSE = True +SESSION_EXPIRE_AT_BROWSER_CLOSE = True - AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', - 'Hostbase.backends.NISBackend') - AUTHORIZED_GROUP = 'support' +# Uncomment a backend below if you would like to use it for authentication +AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', + #'Hostbase.backends.NISBackend', + #'Hostbase.backends.LDAPBacken', + ) - #create login url area: - import django.contrib.auth - django.contrib.auth.LOGIN_URL = '/login' - # Absolute path to the directory that holds media. - # Example: "/home/media/media.lawrence.com/" - MEDIA_ROOT = '' - -if CFG_TYPE == 'environ': - import os - # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. - DATABASE_ENGINE = os.environ['bcfg_db_engine'] - # Or path to database file if using sqlite3. - DATABASE_NAME = os.environ['bcfg_db_name'] - # Not used with sqlite3. - DATABASE_USER = os.environ['bcfg_db_user'] - # Not used with sqlite3. - DATABASE_PASSWORD = os.environ['bcfg_db_password'] - # Set to empty string for localhost. Not used with sqlite3. - DATABASE_HOST = os.environ['bcfg_db_host'] - # Set to empty string for default. Not used with sqlite3. - DATABASE_PORT = os.environ['bcfg_db_port'] - # Local time zone for this installation. All choices can be found here: - # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE - TIME_ZONE = os.environ['bcfg_time_zone'] - # Absolute path to the directory that holds media. - # Example: "/home/media/media.lawrence.com/" - MEDIA_ROOT = os.environ['bcfg_media_root'] - #add non-default AUTH Backends: - AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', - 'Hostbase.backends.LDAPBackend',) - #create login url area: - import django.contrib.auth - django.contrib.auth.LOGIN_URL = '/login' - +# enter an NIS group name you'd like to give access to edit hostbase records +AUTHORIZED_GROUP = '' + +#create login url area: +import django.contrib.auth +django.contrib.auth.LOGIN_URL = '/login' +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = '' + # Language code for this installation. All choices can be found here: # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes # http://blogs.law.harvard.edu/tech/stories/storyReader$15 -- cgit v1.2.3-1-g7c22