{% macro format_checkbox(admin, right, name, users, type) %}
{% set id = right['base_id'] %}
{% set class = 'base_id' %}
{% if type == 'sbas' %}
{% set id = right['sbas_id'] %}
{% set class = 'sbas_id' %}
{% set sbas_class = "" %}
{% else %}
{% set sbas_class = "inside_sbas_" ~ right['sbas_id'] %}
{% endif %}
{% set display = 'block' %}
{% if right[name] != users|length and name != constant('\\ACL::ACCESS') and right[constant('\\ACL::ACCESS')] != users|length and type != 'sbas' %}
{% set display = 'none' %}
{% endif %}
{% if right[name] == 0 %}
{% set class = 'unchecked' %}
{% elseif right[name] == users|length %}
{% set class = 'checked' %}
{% else %}
{% set class = 'mixed' %}
{% endif %}
{% if name == 'access' %}
{% if class != 'checked' and type == 'base' and app.getAclForUser(admin).has_access_to_base(id) is empty %}
{% else %}
{% endif %}
{% else %}
{% if class != 'checked' and type == 'base' and app.getAclForUser(admin).has_right_on_base(id, name) is empty %}
{% elseif class != 'checked' and type == 'sbas' and app.getAclForUser(admin).has_right_on_sbas(id, name) is empty %}
{% else %}
{% endif %}
{% endif %}
{% endmacro %}
{% if main_user is not empty %}
{% set lastConnection = main_user.getLastConnection() is not null ? main_user.getLastConnection() | date('Y-m-d H:i:s') : ' - ' %}
{{ 'admin::users: list user api application' | trans }}
{% set apiApplications = app['repo.api-applications'].findByUser(main_user, true) %}
{% if apiApplications|length > 0 %}
{% for apiApplication in apiApplications %}
- {{ apiApplication.getName() }}
{% if apiApplication.getCreator() is not empty and apiApplication.getCreator().getId() == main_user.getId() %}
{{ 'admin :users: user owned api' | trans }}
{% else %}
{{ 'admin::users: user api use' | trans }}
{% endif %}
{{ 'admin::users: api ID' | trans }} : {{ apiApplication.getId() }}