Commit 9ae9f624 by Bach Dániel

Merge branch 'feature-template-acl-names' into 'master'

Feature Template Acl Names

Add full names to the ACL table in templates

Also a minor fix

Also partially fixing #172
parents c11bddba 20413d14
...@@ -705,6 +705,7 @@ textarea[name="list-new-namelist"] { ...@@ -705,6 +705,7 @@ textarea[name="list-new-namelist"] {
#group-detail-user-table td:nth-child(2) a, #group-detail-user-table td:nth-child(2) a,
#group-detail-perm-table td:nth-child(2) a, #group-detail-perm-table td:nth-child(2) a,
#template-access-table td:nth-child(2) a,
#vm-access-table td:nth-child(2) a, #vm-access-table td:nth-child(2) a,
.no-style-link, .no-style-link:hover { .no-style-link, .no-style-link:hover {
color: #555 !important; color: #555 !important;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div id="dashboard-template-list"> <div id="dashboard-template-list">
{% for t in templates %} {% for t in templates %}
<a href="{% url "dashboard.views.template-detail" pk=t.pk %}" class="list-group-item <a href="{% url "dashboard.views.template-detail" pk=t.pk %}" class="list-group-item
{% if forloop.last and nodes|length < 5 %} list-group-item-last{% endif %}"> {% if forloop.last and templates|length < 5 %} list-group-item-last{% endif %}">
<span class="index-template-list-name"> <span class="index-template-list-name">
<i class="icon-{{ t.os_type }}"></i> {{ t.name }} <i class="icon-{{ t.os_type }}"></i> {{ t.name }}
</span> </span>
......
...@@ -37,48 +37,62 @@ ...@@ -37,48 +37,62 @@
<th>{% trans "Who" %}</th> <th>{% trans "Who" %}</th>
<th>{% trans "What" %}</th> <th>{% trans "What" %}</th>
<th><i class="icon-remove"></i></th> <th><i class="icon-remove"></i></th>
</tr></thead> </tr>
</thead>
<tbody> <tbody>
{% for i in acl.users %} {% for i in acl.users %}
<tr> <tr>
<td><i class="icon-user"></i></td><td>{{i.user}}</td> <td>
<td> <i class="icon-user"></i>
<select class="form-control" name="perm-u-{{i.user.id}}"> </td>
{% for id, name in acl.levels %} <td>
<option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option> <a href="{% url "dashboard.views.profile" username=i.user.username %}"
{% endfor %} title="{{ i.user.username }}">
</select> {% include "dashboard/_display-name.html" with user=i.user show_org=True %}
</td> </a>
<td> </td>
<input type="checkbox" name="remove-u-{{i.user.id}}" title="{% trans "Remove" %}"/> <td>
</td> <select class="form-control" name="perm-u-{{i.user.id}}">
</tr> {% for id, name in acl.levels %}
{% endfor %} <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
{% for i in acl.groups %} {% endfor %}
<tr> </select>
<td><i class="icon-group"></i></td><td>{{i.group}}</td> </td>
<td> <td>
<select class="form-control" name="perm-g-{{i.group.id}}"> <input type="checkbox" name="remove-u-{{i.user.id}}" title="{% trans "Remove" %}"/>
{% for id, name in acl.levels %} </td>
<option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option> </tr>
{% endfor %} {% endfor %}
</select> {% for i in acl.groups %}
</td> <tr>
<td> <td><i class="icon-group"></i></td>
<input type="checkbox" name="remove-g-{{i.group.id}}" title="{% trans "Remove" %}"/> <td>
</td> <a href="{% url "dashboard.views.group-detail" pk=i.group.pk %}">
</tr> {{i.group}}
{% endfor %} </a>
<tr><td><i class="icon-plus"></i></td> </td>
<td><input type="text" class="form-control" name="perm-new-name" <td>
placeholder="{% trans "Name of group or user" %}"></td> <select class="form-control" name="perm-g-{{i.group.id}}">
<td><select class="form-control" name="perm-new"> {% for id, name in acl.levels %}
{% for id, name in acl.levels %} <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
<option value="{{id}}">{{name}}</option> {% endfor %}
{% endfor %} </select>
</select></td><td></td> </td>
</tr> <td>
</tbody> <input type="checkbox" name="remove-g-{{i.group.id}}" title="{% trans "Remove" %}"/>
</td>
</tr>
{% endfor %}
<tr><td><i class="icon-plus"></i></td>
<td><input type="text" class="form-control" name="perm-new-name"
placeholder="{% trans "Name of group or user" %}"></td>
<td><select class="form-control" name="perm-new">
{% for id, name in acl.levels %}
<option value="{{id}}">{{name}}</option>
{% endfor %}
</select></td><td></td>
</tr>
</tbody>
</table> </table>
<div class="form-actions"> <div class="form-actions">
<button type="submit" class="btn btn-success">{% trans "Save" %}</button> <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
......
...@@ -915,7 +915,9 @@ class TemplateAclUpdateView(AclUpdateView): ...@@ -915,7 +915,9 @@ class TemplateAclUpdateView(AclUpdateView):
post_for_disk['perm-new'] = 'user' post_for_disk['perm-new'] = 'user'
request.POST = post_for_disk request.POST = post_for_disk
for d in template.disks.all(): for d in template.disks.all():
self.set_levels(request, d)
self.add_levels(request, d) self.add_levels(request, d)
self.remove_levels(request, d)
return redirect(template) return redirect(template)
......
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 sign in to comment