Project

General

Profile

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

Valentin Deniaud, 28 May 2019 05:24 PM

Download (12.8 KB)

View differences:

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
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if view.can_delete %}
{% if view.could_delete %}
<a rel="popup" href="{% url "a2-manager-ou-delete" pk=object.pk %}">{% trans "Delete" %}</a>
{% else %}
<a class="disabled" title="{% trans "You do not have the rights to delete this organizational unit." %}" href="#">{% trans "Delete" %}</a>
{% endif %}
{% if view.can_change %}
{% if view.could_change %}
<a href="{% url "a2-manager-ou-edit" pk=object.pk %}">{% trans "Edit" %}</a>
{% else %}
<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
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if view.can_add %}
{% if view.could_add %}
<a href="{% url "a2-manager-ou-add" %}" rel="popup">{% trans "Add organizational unit" %}</a>
{% endif %}
</span>
src/authentic2/manager/templates/authentic2/manager/role_members.html
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if not object.is_internal and view.can_delete %}
{% if not object.is_internal and view.could_delete %}
<a rel="popup" href="{% url "a2-manager-role-delete" pk=object.pk %}">{% trans "Delete" %}</a>
{% else %}
<a class="disabled" title="{% trans "This role is technical, you cannot delete it." %}" href="#">{% trans "Delete" %}</a>
{% endif %}
{% if view.can_change and not object.is_internal %}
{% if view.could_change and not object.is_internal %}
<a href="{% url "a2-manager-role-edit" pk=object.pk %}">{% trans "Edit" %}</a>
{% else %}
{% if not view.can_change %}
{% if not view.could_change %}
<a class="disabled" title="{% trans "Permission denied" %}" href="#">{% trans "Edit" %}</a>
{% else %}
<a class="disabled" title="{% trans "This role is technical, you cannot edit it." %}" href="#">{% trans "Edit" %}</a>
......
{% include "authentic2/manager/export_include.html" with export_view_name="a2-manager-role-members-export" %}
{% if view.can_change %}
{% if view.could_change %}
<form method="post" class="manager-m2m-add-form">
{% csrf_token %}
{{ form }}
......
<a title="{% trans "Indirect child role" %}" class="disabled role-remove icon-minus-sign"></a>
{% endif %}
{% endfor %}
{% if view.can_change %}
{% if view.could_change %}
<a rel="popup" href="{% url "a2-manager-role-add-admin-user" pk=object.pk %}" class="role-add icon-add-sign"></a>
{% else %}
<a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
......
<a title="{% trans "Indirect admin role" %}" class="disabled role-remove icon-minus-sign"></a>
{% endif %}
{% endfor %}
{% if view.can_change %}
{% if view.could_change %}
<a rel="popup" href="{% url "a2-manager-role-add-admin-role" pk=object.pk %}" class="role-add icon-add-sign"></a>
{% else %}
<a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
......
<a title="{% trans "Indirect child role" %}" class="disabled role-remove icon-minus-sign"></a>
{% endif %}
{% endfor %}
{% if view.can_change %}
{% if view.could_change %}
<a rel="popup" href="{% url "a2-manager-role-add-child" pk=object.pk %}" class="role-add icon-add-sign"></a>
{% else %}
<a title="{% trans "Permission denied" %}" class="disabled role-add icon-add-sign"></a>
src/authentic2/manager/templates/authentic2/manager/role_members_table.html
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<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>
<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>
{% endblock %}
{% endif %}
src/authentic2/manager/templates/authentic2/manager/role_permissions.html
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if view.can_delete %}
{% if view.could_delete %}
<a rel="popup" href="{% url "a2-manager-role-delete" pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
{% if view.can_change and not object.is_internal %}
{% if view.could_change and not object.is_internal %}
<a href="{% url "a2-manager-role-edit" pk=object.pk %}">{% trans "Edit" %}</a>
{% endif %}
<a href="{% url "a2-manager-role-members" pk=object.pk %}">{% trans "Members" %}</a>
src/authentic2/manager/templates/authentic2/manager/role_permissions_table.html
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if table.context.view.can_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
<td>{% if table.context.view.could_change %}<a class="icon-remove-sign js-remove-object" href="#" data-pk-arg="permission"></a>{% endif %}</td>
{% endblock %}
{% endif %}
src/authentic2/manager/templates/authentic2/manager/roles.html
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if view.can_add %}
{% if view.could_add %}
<a href="{% url "a2-manager-role-add" %}" rel="popup">{% trans "Add role" %}</a>
{% else %}
<a href="#" class="disabled" rel="popup">{% trans "Add role" %}</a>
src/authentic2/manager/templates/authentic2/manager/service_roles_table.html
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<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>
<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>
{% endblock %}
{% endif %}
src/authentic2/manager/templates/authentic2/manager/user_detail.html
{% block appbar %}
{{ block.super }}
<span class="actions">
{% if view.can_delete %}
{% if view.could_delete %}
<a rel="popup" href="{% url "a2-manager-user-delete" pk=object.pk %}">{% trans "Delete" %}</a>
{% else %}
<a class="disabled" title="{% trans "You do not have the rights to delete this user." %}" href="#">{% trans "Delete" %}</a>
{% endif %}
{% if view.can_change %}
{% if view.could_change %}
<a href="{% url "a2-manager-user-edit" pk=object.pk %}">{% trans "Edit" %}</a>
{% else %}
<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
{% render_table table "authentic2/manager/user_roles_table.html" %}
{% endwith %}
{% if view.can_change %}
{% if view.could_change %}
<form method="post" class="manager-m2m-add-form">
{% csrf_token %}
{{ form }}
src/authentic2/manager/templates/authentic2/manager/user_roles_table.html
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<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>
<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>
{% endblock %}
{% endif %}