Work in progress. I've moved permissions management to the new dedicated page. Adding permissions is working but deleting ones. I must also filter the list of users available when creating a super admin because the default admin appears inside :p
This commit is contained in:
tonio
2010-11-25 23:19:04 +01:00
parent f7ec14bc87
commit eff3c7d815
14 changed files with 240 additions and 171 deletions
+20
View File
@@ -0,0 +1,20 @@
{% extends "admin/add_permission.html" %}
{% block html_head %}
{{ block.super }}
<script type="text/javascript">
window.addEvent("domready", function() {
$("id_domain").addEvent("change", function(event) {
domid = this.value;
if (domid == "") {
$("id_user").set("html", "");
return;
}
{% url domains as doms_url %}
new Request({url: "{{ doms_url }}" + domid + "/raw/",
method: "get", onSuccess: function(data) {
$("id_user").set("html", data);
}}).send();
});
});
</script>
{% endblock %}
+18
View File
@@ -0,0 +1,18 @@
{% extends "layout_simple.html" %}
{% load i18n %}
{% block html_head %}
<script src="{{ MEDIA_URL }}js/form.js" type="text/javascript"></script>
{% endblock %}
{% block content %}
<div class="title"><h1>{{ title }}</h1></div>
{% if error %}<div class="error">{{ error }}</div>{% endif %}
<form action="{{ action }}" method="POST" id="permform" name="permform">
{% include "common/genericform.html" %}
<div class="spacer"></div>
<div class="lastrow" align="center">
<input type="submit" name="submit" value="{% trans 'Add' %}" />
</div>
</form>
{% endblock %}
-36
View File
@@ -1,36 +0,0 @@
{% extends "layout_simple.html" %}
{% load i18n %}
{% block html_head %}
<script src="{{ MEDIA_URL }}js/form.js" type="text/javascript"></script>
<script type="text/javascript">
window.addEvent("domready", function() {
$("id_domain").addEvent("change", function(event) {
domid = this.value;
if (domid == "") {
$("id_user").set("html", "");
return;
}
{% url domains as doms_url %}
new Request({url: "{{ doms_url }}" + domid + "/raw/",
method: "get", onSuccess: function(data) {
$("id_user").set("html", data);
}}).send();
});
});
</script>
{% endblock %}
{% block content %}
<div class="title"><h1>{% trans "Add permission" %}</h1></div>
{% if error %}<div class="error">{{ error }}</div>{% endif %}
{% url admin.views.addpermission as addperm_url %}
<form action="{{ addperm_url }}" method="POST" id="permform" name="permform">
{% include "common/genericform.html" %}
<div class="spacer"></div>
<div class="lastrow" align="center">
<input type="submit" name="submit" value="{% trans 'Create' %}" />
</div>
</form>
{% endblock %}
+15 -58
View File
@@ -1,62 +1,19 @@
{% extends "admin/settings_header.html" %}
{% extends "nlayout.html" %}
{% load i18n admin_extras %}
{% block html_head %}
<script src="{{ MEDIA_URL }}js/permissions.js" type="text/javascript"></script>
{% endblock %}
{% block middletitle %}{% trans "Permissions" %}{% endblock %}
{% block menu %}
{% load admin_extras %}
{% settings_menu "permissions" user %}
{% permissions_menu user %}
{% endblock %}
{% block setcontent %}
{% load i18n %}
{% if not admins %}
<p>{% trans "No superuser defined?!" %}</p>
{% else %}
<h4>{% trans "Super administrators" %}</h4>
<table>
<tr>
<th width="50px">{% trans "Actions" %}</th>
<th width="210px">{% trans "Full name" %}</th>
<th>{% trans "User name" %}</th>
<th width="50px">{% trans "Enabled" %}</th>
</tr>
{% for admin in admins %}
<tr class="{% cycle 'odd' 'even' %}">
<td>
{% url admin.views.deletepermission admin.id "SuperAdmins" as del_url %}
<a href="{{ del_url }}" name="deletePerm">
<img src="{{ MEDIA_URL }}pics/remove.png" border="0" title="{% trans 'Remove permission' %}" />
</a>
</td>
<td>{{ admin.first_name }} {{ admin.last_name }}</td>
<td>{{ admin.username }}</td>
<td>{{ admin.is_active|yesno }}</td>
</tr>
{% block content %}
<div id="accordion">
{% for table in permtables %}
<h3 class="toggler atStart">{{ table.title }}</h3>
<div class="element atStart" name="{{ table.addurl }}">
{{ table.content }}
</div>
{% endfor %}
</table>
<br/><br/>
{% endif %}
<h4>{% trans "Domain administrators" %}</h4>
{% if not domadmins %}
<p>{% trans "No domain admin defined." %}</p>
{% else %}
<table>
<tr>
<th width="50px">{% trans "Actions" %}</th>
<th width="210px">{% trans "Domain" %}</th>
<th>{% trans "Name" %}</th>
<th width="50px">{% trans "Enabled" %}</th>
</tr>
{% for admin in domadmins %}
<tr class="{% cycle 'odd' 'even' %}">
<td>
{% url admin.views.deletepermission admin.id "DomainAdmins" as del_url %}
<a href="{{ del_url }}" name="deletePerm">
<img src="{{ MEDIA_URL }}pics/remove.png" border="0"
title="{% trans 'Remove permission' %}" />
</a>
</td>
<td>{{ admin.domain.name }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.user.is_active|yesno }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
{% endblock %}