summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Hostbase
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-10-27 21:04:31 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-10-27 21:04:31 +0000
commite8ee28690e839cf962f70103a28dc54f9f16c365 (patch)
tree8bd988407c6b850a6e06737e839aeb44cdf6b434 /src/lib/Server/Hostbase
parent1b1975d6c4cae86a9b9d6d4ed5ffb9f9ef775f18 (diff)
downloadbcfg2-e8ee28690e839cf962f70103a28dc54f9f16c365.tar.gz
bcfg2-e8ee28690e839cf962f70103a28dc54f9f16c365.tar.bz2
bcfg2-e8ee28690e839cf962f70103a28dc54f9f16c365.zip
nis auth added, login/logout link added to templates
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2462 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Hostbase')
-rw-r--r--src/lib/Server/Hostbase/backends.py34
-rw-r--r--src/lib/Server/Hostbase/hostbase/models.py4
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py57
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/dns.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/edit.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/errors.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/host.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/login.html4
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/logout5
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/navbar2
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/new.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/remove.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/results.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/search.html3
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/zonenew.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/zones.html1
-rw-r--r--src/lib/Server/Hostbase/hostbase/webtemplates/zoneview.html1
-rw-r--r--src/lib/Server/Hostbase/nisauth.py43
-rw-r--r--src/lib/Server/Hostbase/urls.py10
22 files changed, 151 insertions, 24 deletions
diff --git a/src/lib/Server/Hostbase/backends.py b/src/lib/Server/Hostbase/backends.py
index 36d896a9c..c59ed5e93 100644
--- a/src/lib/Server/Hostbase/backends.py
+++ b/src/lib/Server/Hostbase/backends.py
@@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from ldapauth import *
+from nisauth import *
class LDAPBackend(object):
@@ -34,3 +35,36 @@ class LDAPBackend(object):
print str(e)
return None
+
+class NISBackend(object):
+
+ def authenticate(self, username=None, password=None):
+ try:
+ print "start nis authenticate"
+ n = nisauth(username, password)
+ temp_pass = User.objects.make_random_password(100)
+ nis_user = dict(username=username,
+ )
+
+ user_session_obj = dict(
+ email = username + "@mcs.anl.gov",
+ first_name = None,
+ last_name = None,
+ uid = n.uid
+ )
+ user, created = User.objects.get_or_create(username=username)
+
+ return user
+
+ except NISAUTHError, e:
+ print str(e)
+ return None
+
+
+ def get_user(self, user_id):
+ try:
+ return User.objects.get(pk=user_id)
+ except User.DoesNotExist, e:
+ print str(e)
+ return None
+
diff --git a/src/lib/Server/Hostbase/hostbase/models.py b/src/lib/Server/Hostbase/hostbase/models.py
index 3216944ea..613701685 100644
--- a/src/lib/Server/Hostbase/hostbase/models.py
+++ b/src/lib/Server/Hostbase/hostbase/models.py
@@ -65,8 +65,8 @@ class Host(models.Model):
class Interface(models.Model):
TYPE_CHOICES = (
- ('eth', 'ethernet'), ('wl', 'wireless'), ('myr', 'myr'),
- ('mgmt', 'mgmt'), ('tape', 'tape'), ('fe', 'fe')
+ ('eth', 'ethernet'), ('wl', 'wireless'), ('virtual', 'virtual'), ('myr', 'myr'),
+ ('mgmt', 'mgmt'), ('tape', 'tape'), ('fe', 'fe'), ('ge', 'ge')
)
host = models.ForeignKey(Host, edit_inline=models.TABULAR, num_in_admin=2)
mac_addr = models.CharField(maxlength=32, core=True)
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py
index 3807b8283..b88083c94 100644
--- a/src/lib/Server/Hostbase/hostbase/views.py
+++ b/src/lib/Server/Hostbase/hostbase/views.py
@@ -52,7 +52,7 @@ dispatch = {'mac_addr':'i.mac_addr LIKE \'%%%%%s%%%%\'',
## t.TYPE_CHOICES = Interface.TYPE_CHOICES
## t.failures = False
## return HttpResponse(str(t))
-
+
def search(request):
"""Search for hosts in the database
If more than one field is entered, logical AND is used
@@ -92,12 +92,15 @@ def search(request):
cursor.execute(querystring)
results = cursor.fetchall()
- return render_to_response('results.html', {'hosts': results})
+ return render_to_response('results.html',
+ {'hosts': results,
+ 'logged_in': request.session.get('_auth_user_id', False)})
else:
return render_to_response('search.html',
{'TYPE_CHOICES': Interface.TYPE_CHOICES,
'DNS_CHOICES': Name.DNS_CHOICES,
- 'yesno': [(1, 'yes'), (0, 'no')]})
+ 'yesno': [(1, 'yes'), (0, 'no')],
+ 'logged_in': request.session.get('_auth_user_id', False)})
def look(request, host_id):
@@ -108,7 +111,8 @@ def look(request, host_id):
interfaces.append([interface, interface.ip_set.all()])
return render_to_response('host.html',
{'host': host,
- 'interfaces': interfaces})
+ 'interfaces': interfaces,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def dns(request, host_id):
host = Host.objects.get(id=host_id)
@@ -127,7 +131,9 @@ def dns(request, host_id):
{'host': host,
'info': info,
'cnames': cnames,
- 'mxs': mxs})
+ 'mxs': mxs,
+ 'logged_in': request.session.get('_auth_user_id', False)})
+
def gethostdata(host_id, dnsdata=False):
"""Grabs the necessary data about a host
@@ -308,7 +314,8 @@ def edit(request, host_id):
return HttpResponseRedirect('/hostbase/%s/' % host.id)
else:
return render_to_response('errors.html',
- {'failures': validate(request, False, host_id)})
+ {'failures': validate(request, False, host_id),
+ 'logged_in': request.session.get('_auth_user_id', False)})
else:
host = Host.objects.get(id=host_id)
interfaces = []
@@ -317,7 +324,8 @@ def edit(request, host_id):
return render_to_response('edit.html',
{'host': host,
'interfaces': interfaces,
- 'TYPE_CHOICES': Interface.TYPE_CHOICES})
+ 'TYPE_CHOICES': Interface.TYPE_CHOICES,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def confirm(request, item, item_id, host_id=None, name_id=None, zone_id=None):
"""Asks if the user is sure he/she wants to remove an item"""
@@ -412,7 +420,8 @@ def confirm(request, item, item_id, host_id=None, name_id=None, zone_id=None):
'zonemx': zonemx,
'nameserver': nameserver,
'address': address,
- 'zone_id': zone_id})
+ 'zone_id': zone_id,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def dnsedit(request, host_id):
"""Edits specific DNS information
@@ -483,7 +492,8 @@ def dnsedit(request, host_id):
'mxs': mxs,
'request': request,
'interfaces': interfaces,
- 'DNS_CHOICES': Name.DNS_CHOICES})
+ 'DNS_CHOICES': Name.DNS_CHOICES,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def new(request):
"""Function for creating a new host in hostbase
@@ -492,7 +502,8 @@ def new(request):
try:
Host.objects.get(hostname=request.POST['hostname'].lower())
return render_to_response('errors.html',
- {'failures': ['%s already exists in hostbase' % request.POST['hostname']]})
+ {'failures': ['%s already exists in hostbase' % request.POST['hostname']],
+ 'logged_in': request.session.get('_auth_user_id', False)})
except:
pass
if not validate(request, True):
@@ -512,7 +523,9 @@ def new(request):
host.save()
else:
return render_to_response('errors.html',
- {'failures': validate(request, True)})
+ {'failures': validate(request, True),
+ 'logged_in': request.session.get('_auth_user_id', False)})
+
if request.POST['mac_addr_new']:
new_inter = Interface(host=host,
mac_addr=request.POST['mac_addr_new'],
@@ -638,7 +651,8 @@ def new(request):
'NETGROUP_CHOICES': Host.NETGROUP_CHOICES,
'CLASS_CHOICES': Host.CLASS_CHOICES,
'SUPPORT_CHOICES': Host.SUPPORT_CHOICES,
- 'WHATAMI_CHOICES': Host.WHATAMI_CHOICES})
+ 'WHATAMI_CHOICES': Host.WHATAMI_CHOICES,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def remove(request, host_id):
host = Host.objects.get(id=host_id)
@@ -659,7 +673,8 @@ def remove(request, host_id):
interfaces.append([interface, interface.ip_set.all()])
return render_to_response('remove.html',
{'host': host,
- 'interfaces': interfaces})
+ 'interfaces': interfaces,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def validate(request, new=False, host_id=None):
"""Function for checking form data"""
@@ -753,7 +768,8 @@ def validate(request, new=False, host_id=None):
def zones(request):
zones = Zone.objects.all()
return render_to_response('zones.html',
- {'zones': zones})
+ {'zones': zones,
+ 'logged_in': request.session.get('_auth_user_id', False)})
def zoneview(request, zone_id):
zone = Zone.objects.get(id=zone_id)
@@ -761,7 +777,8 @@ def zoneview(request, zone_id):
{'zone': zone,
'nameservers': zone.nameservers.all(),
'mxs': zone.mxs.all(),
- 'addresses': zone.addresses.all()
+ 'addresses': zone.addresses.all(),
+ 'logged_in': request.session.get('_auth_user_id', False)
})
def zoneedit(request, zone_id):
@@ -819,7 +836,8 @@ def zoneedit(request, zone_id):
{'zone': zone,
'nameservers': zone.nameservers.all(),
'mxs': zone.mxs.all(),
- 'addresses': zone.addresses.all()
+ 'addresses': zone.addresses.all(),
+ 'logged_in': request.session.get('_auth_user_id', False)
})
def zonenew(request):
@@ -827,7 +845,9 @@ def zonenew(request):
try:
Zone.objects.get(zone=request.POST['zone'])
return render_to_response('errors.html',
- {'failures': ['%s already exists in database' % request.POST['zone']]})
+ {'failures': ['%s already exists in database' % request.POST['zone']],
+ 'logged_in': request.session.get('_auth_user_id', False)})
+
except:
zone = Zone(zone=request.POST['zone'])
for attrib in zoneattribs:
@@ -859,7 +879,8 @@ def zonenew(request):
return render_to_response('zonenew.html',
{'nameservers': range(0,4),
'mxs': range(0,2),
- 'addresses': range(0,2)
+ 'addresses': range(0,2),
+ 'logged_in': request.session.get('_auth_user_id', False)
})
if settings.CFG_TYPE == 'environ':
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html b/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html
index f1f90939e..bc3e7f447 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html
@@ -9,6 +9,7 @@
{% block sidebar %}
{% include "navbar" %}
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/dns.html b/src/lib/Server/Hostbase/hostbase/webtemplates/dns.html
index 1db012852..5d5a31b95 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/dns.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/dns.html
@@ -14,6 +14,7 @@
<li><a href="/hostbase/{{ host.id }}/edit/" class="sidebar">edit host info</a></li>
<li><a href="edit/" class="sidebar">edit dns info</a></li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html
index 1d6245e81..0385daa86 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html
@@ -14,6 +14,7 @@
<li><a href="/hostbase/{{ host.id }}/edit/" class="sidebar">edit host info</a></li>
<li><a href="edit/" class="sidebar">edit dns info</a></li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html
index 0785b64e8..49e054e8a 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html
@@ -14,6 +14,7 @@
<li><a href="/hostbase/{{ host.id }}/dns/" class="sidebar">detailed dns info</a></li>
<li><a href="/hostbase/{{ host.id }}/dns/edit/" class="sidebar">edit dns info</a></li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html
index d321c529f..724bf9c34 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html
@@ -9,6 +9,7 @@
{% block sidebar %}
{% include "navbar" %}
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
index 088befe88..2f557cf73 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html
@@ -14,6 +14,7 @@
<li><a href="edit/" class="sidebar">edit host info</a></li>
<li><a href="dns/edit/" class="sidebar">edit dns info</a></li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/login.html b/src/lib/Server/Hostbase/hostbase/webtemplates/login.html
index 5a5650d22..e46ccc086 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/login.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/login.html
@@ -21,7 +21,11 @@
<input name="password" type="password">
<br />
<input type="submit" value="Login">
+ {% if next %}
<input type="hidden" name="next" value="{{ next }}" />
+ {% else %}
+ <input type="hidden" name="next" value="/hostbase/" />
+ {% endif %}
</form>
{% endif %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/logout b/src/lib/Server/Hostbase/hostbase/webtemplates/logout
new file mode 100644
index 000000000..9fa46236f
--- /dev/null
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/logout
@@ -0,0 +1,5 @@
+{% if logged_in %}
+<p> <a href="/logout/" class="sidebar">logout</a>
+{% else %}
+<p> <a href="/login/" class="sidebar">login</a>
+{% endif %} \ No newline at end of file
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/navbar b/src/lib/Server/Hostbase/hostbase/webtemplates/navbar
index 32ef99177..6efcee7a1 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/navbar
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/navbar
@@ -1,4 +1,4 @@
<a href="/hostbase/" class="sidebar">new search</a><br>
<a href="/hostbase/new" class="sidebar">add a new host</a><br>
-<a href="/hostbase/zones" class="sidebar">zone file information</a>
+<a href="/hostbase/zones" class="sidebar">zone file information</a><br>
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/new.html b/src/lib/Server/Hostbase/hostbase/webtemplates/new.html
index bcec42404..c965d5af4 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/new.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/new.html
@@ -9,6 +9,7 @@
{% block sidebar %}
<a href="/hostbase/" class="sidebar">search hostbase</a>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/remove.html b/src/lib/Server/Hostbase/hostbase/webtemplates/remove.html
index 19c73b4f9..6dfe5aa18 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/remove.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/remove.html
@@ -14,6 +14,7 @@
<li><a href="edit/" class="sidebar">edit host info</a></li>
<li><a href="dns/edit/" class="sidebar">edit dns info</a></li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/results.html b/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
index 584453f98..43cb78f67 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/results.html
@@ -9,6 +9,7 @@
{% block sidebar %}
{% include "navbar" %}
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/search.html b/src/lib/Server/Hostbase/hostbase/webtemplates/search.html
index 31f9d5184..1c869f0d7 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/search.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/search.html
@@ -10,7 +10,8 @@
{% block sidebar %}
<a href="/hostbase/new" class="sidebar">add a new host</a><br>
-<a href="/hostbase/zones" class="sidebar">zone file information</a>
+<a href="/hostbase/zones" class="sidebar">zone file information</a><br>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
index c86268614..d1cf08f17 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneedit.html
@@ -14,6 +14,7 @@
<li><a href="/hostbase/zones/{{ zone.id }}/" class="sidebar">view zone</a><br>
</li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/zonenew.html b/src/lib/Server/Hostbase/hostbase/webtemplates/zonenew.html
index 12ea3e484..b3d12f9f8 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/zonenew.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/zonenew.html
@@ -10,6 +10,7 @@
{% block sidebar %}
{% include "navbar" %}
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/zones.html b/src/lib/Server/Hostbase/hostbase/webtemplates/zones.html
index dcf9a3431..b8808f8a8 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/zones.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/zones.html
@@ -10,6 +10,7 @@
{% block sidebar %}
{% include "navbar" %}
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneview.html b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneview.html
index 712ec98bc..e4a3a3fde 100644
--- a/src/lib/Server/Hostbase/hostbase/webtemplates/zoneview.html
+++ b/src/lib/Server/Hostbase/hostbase/webtemplates/zoneview.html
@@ -14,6 +14,7 @@
<li><a href="/hostbase/zones/{{ zone.id }}/edit/" class="sidebar">edit zone</a><br>
</li>
</ul>
+{% include "logout" %}
{% endblock %}
{% block content %}
diff --git a/src/lib/Server/Hostbase/nisauth.py b/src/lib/Server/Hostbase/nisauth.py
new file mode 100644
index 000000000..24673ec17
--- /dev/null
+++ b/src/lib/Server/Hostbase/nisauth.py
@@ -0,0 +1,43 @@
+import os
+import pwd, crypt, nis
+
+"""Checks with NIS to see if the current user is in the support group"""
+
+__revision__ = "$Revision: $"
+
+class NISAUTHError(Exception):
+ """NISAUTHError is raised when somehting goes boom."""
+ pass
+
+class nisauth(object):
+ group_test = False
+# check_member_of = os.environ['LDAP_CHECK_MBR_OF_GRP']
+ samAcctName = None
+ distinguishedName = None
+ sAMAccountName = None
+ telephoneNumber = None
+ title = None
+ memberOf = None
+ department = None #this will be a list
+ mail = None
+ extensionAttribute1 = None #badgenumber
+ badge_no = None
+ uid = None
+
+ def __init__(self,login,passwd=None):
+ """get user profile from NIS"""
+ try:
+ p = pwd.getpwnam(login)
+ print p
+ except:
+ raise NISAUTHError('username')
+ # check user password using crypt and 2 character salt from passwd file
+ if p[1] == crypt.crypt(passwd, p[1][:2]):
+ # check to see if user is in valid support groups
+ # will have to include these groups in a settings file eventually
+ if not login in nis.match('support', 'group.byname').split(':')[-1].split(','):
+ raise NISAUTHError('group')
+ self.uid = p[2]
+ print self.uid
+ else:
+ raise NISAUTHError('password')
diff --git a/src/lib/Server/Hostbase/urls.py b/src/lib/Server/Hostbase/urls.py
index 67ff1a308..5c57f38bd 100644
--- a/src/lib/Server/Hostbase/urls.py
+++ b/src/lib/Server/Hostbase/urls.py
@@ -1,6 +1,8 @@
import os
from django.conf.urls.defaults import *
+os.environ['bcfg_media_root'] = "/homes/raffenet/under_contruction/djangobase/bcfg2/src/lib/Server/Hostbase/media"
+
urlpatterns = patterns('Hostbase.hostbase.views',
(r'^admin/', include('django.contrib.admin.urls')),
@@ -18,10 +20,12 @@ urlpatterns = patterns('Hostbase.hostbase.views',
(r'^hostbase/zones/(?P<zone_id>\d+)/$', 'zoneview'),
(r'^hostbase/zones/(?P<zone_id>\d+)/edit', 'zoneedit'),
(r'^hostbase/zones/new/$', 'zonenew'),
- (r'^hostbase/zones/(?P<zone_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/confirm', 'confirm'))
- #(r'^login/$', 'login'),
+ (r'^hostbase/zones/(?P<zone_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/confirm', 'confirm'),
+ )
+
#fixme: this is a temp. kludge to handle static serving of css, img, js etc...
#a better solution is to use mod_python/apache directives for the static serving
+
urlpatterns += patterns('',
(r'^site_media/(.*)$',
'django.views.static.serve',
@@ -31,5 +35,7 @@ urlpatterns += patterns('',
urlpatterns += patterns('',
(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'login.html'}),
+ (r'^logout/$', 'django.contrib.auth.views.logout',
+ {'template_name': 'logout.html'})
)