Projet

Général

Profil

0007-manager-use-could_-action-instead-of-can_-in-templat.patch

Valentin Deniaud, 28 mai 2019 17:24

Télécharger (12,8 ko)

Voir les différences:

Subject: [PATCH 7/8] manager: use could_{action} instead of can_ in templates
 (#33515)

 .../templates/authentic2/manager/ou_detail.html    |  4 ++--
 .../manager/templates/authentic2/manager/ous.html  |  2 +-
 .../templates/authentic2/manager/role_members.html | 14 +++++++-------
 .../authentic2/manager/role_members_table.html     |  2 +-
 .../authentic2/manager/role_permissions.html       |  4 ++--
 .../authentic2/manager/role_permissions_table.html |  2 +-
 .../templates/authentic2/manager/roles.html        |  2 +-
 .../authentic2/manager/service_roles_table.html    |  2 +-
 .../templates/authentic2/manager/user_detail.html  |  4 ++--
 .../templates/authentic2/manager/user_roles.html   |  2 +-
 .../authentic2/manager/user_roles_table.html       |  2 +-
 11 files changed, 20 insertions(+), 20 deletions(-)
src/authentic2/manager/templates/authentic2/manager/ou_detail.html
17 17
{% block appbar %}
18 18
  {{ block.super }}
19 19
  <span class="actions">
20
  {% if view.can_delete %}
20
  {% if view.could_delete %}
21 21
    <a rel="popup" href="{% url "a2-manager-ou-delete" pk=object.pk %}">{% trans "Delete" %}</a>
22 22
  {% else %}
23 23
    <a class="disabled" title="{% trans "You do not have the rights to delete this organizational unit." %}" href="#">{% trans "Delete" %}</a>
24 24
  {% endif %}
25 25

  
26
  {% if view.can_change %}
26
  {% if view.could_change %}
27 27
    <a href="{% url "a2-manager-ou-edit" pk=object.pk %}">{% trans "Edit" %}</a>
28 28
  {% else %}
29 29
    <a class="disabled" title="{% trans "You do not have the rights to edit this organizational unit." %}" href="#">{% trans "Edit" %}</a>
src/authentic2/manager/templates/authentic2/manager/ous.html
10 10
{% block appbar %}
11 11
  {{ block.super }}
12 12
  <span class="actions">
13
  {% if view.can_add %}
13
  {% if view.could_add %}
14 14
    <a href="{% url "a2-manager-ou-add" %}" rel="popup">{% trans "Add organizational unit" %}</a>
15 15
  {% endif %}
16 16
  </span>
src/authentic2/manager/templates/authentic2/manager/role_members.html
19 19
{% block appbar %}
20 20
  {{ block.super }}
21 21
  <span class="actions">
22
  {% if not object.is_internal and view.can_delete %}
22
  {% if not object.is_internal and view.could_delete %}
23 23
    <a rel="popup" href="{% url "a2-manager-role-delete" pk=object.pk %}">{% trans "Delete" %}</a>
24 24
  {% else %}
25 25
    <a class="disabled" title="{% trans "This role is technical, you cannot delete it." %}" href="#">{% trans "Delete" %}</a>
26 26
  {% endif %}
27
  {% if view.can_change and not object.is_internal %}
27
  {% if view.could_change and not object.is_internal %}
28 28
    <a href="{% url "a2-manager-role-edit" pk=object.pk %}">{% trans "Edit" %}</a>
29 29
  {% else %}
30
    {% if not view.can_change %}
30
    {% if not view.could_change %}
31 31
      <a class="disabled" title="{% trans "Permission denied" %}" href="#">{% trans "Edit" %}</a>
32 32
    {% else %}
33 33
      <a class="disabled" title="{% trans "This role is technical, you cannot edit it." %}" href="#">{% trans "Edit" %}</a>
......
52 52

  
53 53
 {% include "authentic2/manager/export_include.html" with export_view_name="a2-manager-role-members-export" %}
54 54

  
55
 {% if view.can_change %}
55
 {% if view.could_change %}
56 56
   <form method="post" class="manager-m2m-add-form">
57 57
           {% csrf_token %}
58 58
           {{ form }}
......
71 71
       <a title="{% trans "Indirect child role" %}" class="disabled role-remove icon-minus-sign"></a>
72 72
     {% endif %}
73 73
   {% endfor %}
74
  {% if view.can_change %}
74
  {% if view.could_change %}
75 75
    <a rel="popup" href="{% url "a2-manager-role-add-admin-user" pk=object.pk %}" class="role-add icon-add-sign"></a>
76 76
  {% else %}
77 77
    <a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
......
87 87
       <a title="{% trans "Indirect admin role" %}" class="disabled role-remove icon-minus-sign"></a>
88 88
     {% endif %}
89 89
   {% endfor %}
90
  {% if view.can_change %}
90
  {% if view.could_change %}
91 91
    <a rel="popup" href="{% url "a2-manager-role-add-admin-role" pk=object.pk %}" class="role-add icon-add-sign"></a>
92 92
  {% else %}
93 93
    <a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
......
103 103
       <a title="{% trans "Indirect child role" %}" class="disabled role-remove icon-minus-sign"></a>
104 104
     {% endif %}
105 105
   {% endfor %}
106
  {% if view.can_change %}
106
  {% if view.could_change %}
107 107
    <a rel="popup" href="{% url "a2-manager-role-add-child" pk=object.pk %}" class="role-add icon-add-sign"></a>
108 108
  {% else %}
109 109
    <a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
src/authentic2/manager/templates/authentic2/manager/role_members_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
  <td>{% if table.context.view.can_change and row.record.direct %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with username=row.record.get_full_name role=table.context.object %}Do you really want to remove user &quot;{{ username }}&quot; from role &quot;{{ role }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="user"></a>{% endif %}</td>
10
  <td>{% if table.context.view.could_change and row.record.direct %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with username=row.record.get_full_name role=table.context.object %}Do you really want to remove user &quot;{{ username }}&quot; from role &quot;{{ role }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="user"></a>{% endif %}</td>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/role_permissions.html
10 10
{% block appbar %}
11 11
  {{ block.super }}
12 12
  <span class="actions">
13
  {% if view.can_delete %}
13
  {% if view.could_delete %}
14 14
    <a rel="popup" href="{% url "a2-manager-role-delete" pk=object.pk %}">{% trans "Delete" %}</a>
15 15
  {% endif %}
16
  {% if view.can_change and not object.is_internal %}
16
  {% if view.could_change and not object.is_internal %}
17 17
    <a href="{% url "a2-manager-role-edit" pk=object.pk %}">{% trans "Edit" %}</a>
18 18
  {% endif %}
19 19
  <a href="{% url "a2-manager-role-members" pk=object.pk %}">{% trans "Members" %}</a>
src/authentic2/manager/templates/authentic2/manager/role_permissions_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
    <td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
10
    <td>{% if table.context.view.could_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/roles.html
6 6
{% block appbar %}
7 7
  {{ block.super }}
8 8
  <span class="actions">
9
  {% if view.can_add %}
9
  {% if view.could_add %}
10 10
    <a href="{% url "a2-manager-role-add" %}" rel="popup">{% trans "Add role" %}</a>
11 11
  {% else %}
12 12
    <a href="#" class="disabled" rel="popup">{% trans "Add role" %}</a>
src/authentic2/manager/templates/authentic2/manager/service_roles_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
    <td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name slug=table.context.object %}Do you really want to remove role &quot;{{ name }}&quot; from service &quot;{{ slug }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
10
    <td>{% if table.context.view.could_change %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name slug=table.context.object %}Do you really want to remove role &quot;{{ name }}&quot; from service &quot;{{ slug }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
11 11
  {% endblock %}
12 12
{% endif %}
src/authentic2/manager/templates/authentic2/manager/user_detail.html
6 6
{% block appbar %}
7 7
  {{ block.super }}
8 8
  <span class="actions">
9
  {% if view.can_delete %}
9
  {% if view.could_delete %}
10 10
    <a rel="popup" href="{% url "a2-manager-user-delete" pk=object.pk %}">{% trans "Delete" %}</a>
11 11
  {% else %}
12 12
    <a class="disabled" title="{% trans "You do not have the rights to delete this user." %}" href="#">{% trans "Delete" %}</a>
13 13
  {% endif %}
14 14

  
15
  {% if view.can_change %}
15
  {% if view.could_change %}
16 16
    <a href="{% url "a2-manager-user-edit" pk=object.pk %}">{% trans "Edit" %}</a>
17 17
  {% else %}
18 18
    <a class="disabled" title="{% trans "You do not have the rights to edit this user." %}" href="#">{% trans "Edit" %}</a>
src/authentic2/manager/templates/authentic2/manager/user_roles.html
33 33
   {% render_table table "authentic2/manager/user_roles_table.html" %}
34 34
 {% endwith %}
35 35

  
36
 {% if view.can_change %}
36
 {% if view.could_change %}
37 37
   <form method="post" class="manager-m2m-add-form">
38 38
           {% csrf_token %}
39 39
           {{ form }}
src/authentic2/manager/templates/authentic2/manager/user_roles_table.html
7 7
    <th></th>
8 8
  {% endblock %}
9 9
  {% block table.tbody.last.column %}
10
  <td>{% if table.context.view.can_change and row.record.member %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name username=table.context.object.get_full_name %}Do you really want to remove role &quot;{{ name }}&quot; from user &quot;{{ username }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
10
  <td>{% if table.context.view.could_change and row.record.member %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name username=table.context.object.get_full_name %}Do you really want to remove role &quot;{{ name }}&quot; from user &quot;{{ username }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
11 11
  {% endblock %}
12 12
{% endif %}
13
-