access.html 2.85 KB
Newer Older
1 2 3
{% load i18n %}
<h3>{% trans "Owner" %}</h3>
<p>
4
  {% if user == instance.owner %}
5
  {% blocktrans %}You are the current owner of this instance.{% endblocktrans %}
6 7 8 9 10 11 12 13 14
  {% else %}
  {% blocktrans with owner=instance.owner %}
    The current owner of this instance is {{owner}}.
  {% endblocktrans %}
  {% endif %}
  {% if user == instance.owner or user.is_superuser %}
  <a href="{% url "dashboard.views.vm-transfer-ownership" instance.pk %}"
      class="btn btn-link">{% trans "Transfer ownership..." %}</a>
  {% endif %}
15 16
</p>
<h3>{% trans "Permissions"|capfirst %}</h3>
17
  <form action="{{acl.url}}" method="post">{% csrf_token %}
18 19 20 21 22 23 24
  <table class="table table-striped table-with-form-fields" id="vm-access-table">
    <thead><tr>
        <th></th>
        <th>{% trans "Who" %}</th>
        <th>{% trans "What" %}</th>
        <th>{% trans "Remove" %}</th>
    </tr></thead>
25
    <tbody>
26
        {% for i in acl.users %}
27 28
        <tr>
          <td><i class="icon-user"></i></td>
29
          <td>
30
            <a href="{% url "dashboard.views.profile" username=i.user.username %}" title="{{ i.user.username }}"
31 32
              >{% include "dashboard/_display-name.html" with user=i.user show_org=True %}</a>
          </td>
33 34 35 36 37 38 39 40 41 42 43
          <td>
            <select class="form-control" name="perm-u-{{i.user.id}}">
              {% for id, name in acl.levels %}
                <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
              {% endfor %}
            </select>
          </td>
          <td>
            <input type="checkbox" name="remove-u-{{i.user.id}}"/>
          </td>
        </tr>
44 45
        {% endfor %}
        {% for i in acl.groups %}
46
        <tr>
47 48 49 50 51
          <td><i class="icon-group"></i></td>
          <td>
            <a href="{% url "dashboard.views.group-detail" pk=i.group.pk %}"
              >{{ i.group.name }}</a>
          </td>
52 53 54 55 56
          <td>
            <select class="form-control" name="perm-g-{{i.group.id}}">
              {% for id, name in acl.levels %}
              <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
              {% endfor %}
57
            </select></td>
58 59 60 61
          <td>
            <input type="checkbox" name="remove-g-{{i.group.id}}"/>
          </td>
        </tr>
62
        {% endfor %}
63 64 65 66 67 68 69 70 71
        <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>
72 73 74 75 76
  </tbody>
  </table>
  <div class="form-actions">
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
77
  </form>