Commit c491c6f8 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Added alternate view for Helpdesk

Added view for Helpdesk with an "overview" perms attribute. This closes #2063,
closes #2046, closes #1898.
parent 72f63330
......@@ -100,3 +100,7 @@ Under the templates folder (templates), you can alter the footer.html file to in
* Modify flatpages to suit your needs
* Once Apache proxying and shibboleth modules are properly setup, login to the tool. If shibboleth SP is properly setup you should see a user pending activation message and an activation email should arrive at the NOTIFY_ADMIN_MAILS accounts.
5. UPDATING:
* from 0.9.1 to 0.9.2:
- Check diff between urls
- run ./manage.py migrate accounts (data migration for perms)
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserProfile'
db.create_table('accounts_userprofile', (
('peer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['peers.Peer'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True)),
))
db.send_create_signal('accounts', ['UserProfile'])
def backwards(self, orm):
# Deleting model 'UserProfile'
db.delete_table('accounts_userprofile')
models = {
'accounts.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'peer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['peers.Peer']"}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
},
'contenttypes.contenttype': {
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'peers.peer': {
'Meta': {'object_name': 'Peer', 'db_table': "u'peer'"},
'domain_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
'networks': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['peers.PeerRange']", 'null': 'True', 'blank': 'True'}),
'peer_as': ('django.db.models.fields.IntegerField', [], {}),
'peer_id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}),
'peer_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'peer_tag': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'techc_emails': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['peers.TechcEmail']", 'null': 'True', 'blank': 'True'})
},
'peers.peerrange': {
'Meta': {'object_name': 'PeerRange', 'db_table': "u'peer_range'"},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'network': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'peers.techcemail': {
'Meta': {'object_name': 'TechcEmail', 'db_table': "'techc_email'"},
'email': ('django.db.models.fields.CharField', [], {'max_length': '352', 'db_column': "'email'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['accounts']
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
ct, created = orm['contenttypes.ContentType'].objects.get_or_create(
model='userprofile', app_label='accounts') # model must be lowercase!
perm, created = orm['auth.permission'].objects.get_or_create(
content_type=ct, codename='overview', defaults=dict(name=u'Can see registered users and rules'))
def backwards(self, orm):
"Write your backwards methods here."
ct, created = orm['contenttypes.ContentType'].objects.get_or_create(
model='userprofile', app_label='accounts') # model must be lowercase!
perm, created = orm['auth.permission'].objects.get_or_create(
content_type=ct, codename='overview')
perm.delete()
models = {
'accounts.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'peer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['peers.Peer']"}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
},
'contenttypes.contenttype': {
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'peers.peer': {
'Meta': {'object_name': 'Peer', 'db_table': "u'peer'"},
'domain_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
'networks': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['peers.PeerRange']", 'null': 'True', 'blank': 'True'}),
'peer_as': ('django.db.models.fields.IntegerField', [], {}),
'peer_id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}),
'peer_name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'peer_tag': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'techc_emails': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['peers.TechcEmail']", 'null': 'True', 'blank': 'True'})
},
'peers.peerrange': {
'Meta': {'object_name': 'PeerRange', 'db_table': "u'peer_range'"},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'network': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'peers.techcemail': {
'Meta': {'object_name': 'TechcEmail', 'db_table': "'techc_email'"},
'email': ('django.db.models.fields.CharField', [], {'max_length': '352', 'db_column': "'email'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['accounts']
......@@ -7,6 +7,12 @@ class UserProfile(models.Model):
user = models.OneToOneField(User)
peer = models.ForeignKey(Peer)
class Meta:
permissions = (
("overview", "Can see registered users and rules"),
)
def __unicode__(self):
return "%s:%s" %(self.user.username, self.peer.peer_name)
......
......@@ -436,6 +436,22 @@ def selectinst(request):
form.fields['institution'] = forms.ModelChoiceField(queryset=Peer.objects.all(), empty_label=None)
return render_to_response('registration/select_institution.html', {'form': form}, context_instance=RequestContext(request))
@never_cache
def overview(request):
user = request.user
if user.is_authenticated():
if user.has_perm('accounts.overview'):
users = User.objects.all()
group_routes = Route.objects.all()
return render_to_response('overview/index.html', {'users': users, 'routes': group_routes},
context_instance=RequestContext(request))
else:
violation=True
return render_to_response('overview/index.html', {'violation': violation},
context_instance=RequestContext(request))
else:
return HttpResponseRedirect(reverse("altlogin"))
@login_required
@never_cache
def user_logout(request):
......@@ -471,6 +487,7 @@ def send_new_mail(subject, message, from_email, recipient_list, bcc_list):
def lookupShibAttr(attrmap, requestMeta):
for attr in attrmap:
if (attr in requestMeta) & (len(requestMeta[attr]) > 0):
return requestMeta[attr]
return ''
\ No newline at end of file
if (attr in requestMeta.keys()):
if len(requestMeta[attr]) > 0:
return requestMeta[attr]
return ''
This diff is collapsed.
......@@ -98,9 +98,15 @@ body {
<ul class="nav">
{% if user.is_authenticated %}
{% if user.get_profile.peer %}
<li>
<a href="{% url user-profile %}">{% trans "My profile" %}</a>
</li>
{% endif %}
{% if perms.accounts.overview %}<li>
<a href="{% url overview %}">{% trans "Overview" %}</a>
</li>{% endif %}
{% if user.is_superuser %}
<li {% block hometop %}{% endblock %}>
<a href="{% url admin:index %}">{% trans "Admin" %}</a>
......
......@@ -2,14 +2,15 @@
<footer class="footer">
<div id="footcontainer" class="container">
{% if user.is_authenticated %}
<p>{% trans "If you have any questions or need help, contact GRNET Helpdesk at <a href='mailto:helpdesk@grnet.gr'>helpdesk@grnet.gr</a> or 800-11-47638." %}</p>
{% endif %}
<div style="padding-top: 10px;">{% trans "Designed and developed by GRNET NOC" %}</div>
<div style="padding-top: 10px;">{% trans "Designed and developed by GRNET NOC" %}
<a href="//facebook.com/noc.grnet.gr" target="_blank"><img src="/fodstatic/img/facebook_img.png" alt="GRNET NOC on Facebook" title="GRNET NOC on Facebook"/></a> <a href="//twitter.com/grnetnoc" target="_blank"><img src="/fodstatic/img/twitter_img.png" alt="GRNET NOC on Twitter" title="GRNET NOC on Twitter"/></a>
</div>
<div class="row"><a href="http://noc.grnet.gr">{% trans "GRNET" %} NOC</a> | <a href="/fod/info/{{LANGUAGE_CODE}}/">{% trans "Info" %}</a> | <a href="/fod/tos/{{LANGUAGE_CODE}}/">{% trans "Service Terms" %}</a></div>
<div style="padding-top: 10px;">
<a href="//facebook.com/noc.grnet.gr" target="_blank"><img src="/fodstatic/img/facebook_img.png" alt="GRNET NOC on Facebook" title="GRNET NOC on Facebook"/></a> <a href="//twitter.com/grnetnoc" target="_blank"><img src="/fodstatic/img/twitter_img.png" alt="GRNET NOC on Twitter" title="GRNET NOC on Twitter"/></a>
</div>
<div style="padding-top: 10px;">
<p style="text-align: center;"><img width="46" height="40" border="0" class="image image-img_assist_custom-46x40 " src="//noc.grnet.gr/sites/default/files/images/image_PSSYGK.img_assist_custom-46x40.png" alt="Flag ΨΣ" title="Flag ΨΣ"> <img width="49" height="40" border="0" class="image image-img_assist_custom-49x40 " src="//noc.grnet.gr/sites/default/files/images/image_EEflag.img_assist_custom-49x40.png" alt="EU flag" title="EU flag"> <img width="90" height="40" border="0" class="image image-img_assist_custom-90x40 " src="//noc.grnet.gr/sites/default/files/images/image_YPDBMTH.img_assist_custom-90x40.png" alt="Flag ΥΠΔΒΜΘ" title="Flag ΥΠΔΒΜΘ"><img width="67" height="40" border="0" class="image image-img_assist_custom-67x40 " src="//noc.grnet.gr/sites/default/files/images/image_ESPA.img_assist_custom-67x40.png" alt="ESPA" title="ESPA"></p>
......
This diff is collapsed.
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Overview Login" %}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
</div><!--/span-->
<div class="span10">
<div class="row-fluid">
<!--/span-->
<h3 class="muted">{% trans "Overview Login" %}</h3>
<hr>
<form class="form-horizontal" method="post"
action="{% url altlogin %}">
{% if form.non_field_errors %} {% for err in form.non_field_errors %}
<div class="control-group error ">
<div class="controls error">
<span style="color: #B94A48;">{{err}}</span>
</div>
</div>
{% endfor %} {% endif %} {% csrf_token %}
<div class="control-group {% if form.username.errors %} error {% endif %}">
<label class="control-label" for="id_username">Username</label>
<div class="controls">
{{ form.username }} {% if form.username.errors %} <span class="help-inline"> {{ form.username.errors|join:", "}} </span> {% endif %}
</div>
</div>
<div class="control-group {% if form.password.errors %} error {% endif %}">
<label class="control-label" for="id_password">Password</label>
<div class="controls">
{{ form.password }} {% if form.password.errors %} <span
class="help-inline"> {{ form.password.errors|join:", "}} </span> {% endif %}
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Sign in</button>
<input type="hidden" name="next" value="{% url overview %}" />
</div>
</div>
</form>
<!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/span-->
</div><!--/.fluid-container-->
{% endblock %}
......@@ -5,13 +5,17 @@
{% block contentplaceholder %}
<div id="content" class="container">
<div class="hero-unit" style="text-align:center"><h2>GRNET - Firewall on Demand</h2>
<p><img src="/fodstatic/img/fod_footer_logo.png" /></p>
<p>
<iframe width="640" height="360" src="https://www.youtube.com/embed/VZy7DG8sjSk?rel=0" frameborder="0" allowfullscreen></iframe>
</p>
<p>{% blocktrans %}Welcome to GRNET's FoD service.{% endblocktrans %}</p>
</div>
<div class="row-fluid">
<div class="span4 well"><h3>{% trans "What" %}?</h3><hr>
<p>{% blocktrans %}If you are new to the service, take some time to read the{% endblocktrans %} <a href="/fod/info/{{LANGUAGE_CODE}}/">{% trans "Service Description" %}</a></p>
<p>{% blocktrans %}Before asking why? take some time to look at the{% endblocktrans %} <a href="/fod/tos/{{LANGUAGE_CODE}}/">{% trans "Service Terms" %}</a></p>
</div>
<div class="span4 well"><h3>{% trans "How" %}?</h3><hr>
<p>{% blocktrans %}If you have properly set your Shibboleth attributes, you may proceed{% endblocktrans %}</p>
......@@ -24,7 +28,10 @@
</div>
</div>
<div class="span4 well"><h3>{% trans "Help" %}?</h3><hr>
{% blocktrans %}For troubleshooting info and remarks do not hesitate to contact GRNET's Helpdesk.{% endblocktrans %}</div>
<p>
<p>{% blocktrans %}For troubleshooting info and remarks do not hesitate to contact GRNET's Helpdesk.{% endblocktrans %}</p>
</p>
</div>
</div>
</div>
......
......@@ -34,6 +34,10 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
(r'^fod/admin/', include(admin.site.urls)),
(r'^tinymce/', include('tinymce.urls')),
url(r'^fod/altlogin/?', 'django.contrib.auth.views.login', {'template_name': 'overview/login.html'}, name="altlogin"),
url(r'^fod/overview/?$', 'flowspy.flowspec.views.overview', name="overview"),
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment