Add getAuthenticator usage

Replace $app['authentication']->getUser() by $app->getAuthenticatedUser()
replace twig app['authentication'].getUser() with corresponding method
This commit is contained in:
Benoît Burnichon
2015-06-30 19:51:02 +02:00
parent 3804eb5408
commit 4880f2bf5a
113 changed files with 437 additions and 428 deletions

View File

@@ -34,7 +34,7 @@
<li>{{ collection.get_record_amount() }} records <a class="ajax" target="rights" href="{{ path('admin_collection_display_document_details', { 'bas_id' : collection.get_base_id() }) }}">{{ 'phraseanet:: details' | trans }}</a></li>
</ul>
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<div class="well well-small">
<h5>{{ 'admin::collection:: Gestionnaires des commandes' | trans }}</h5>
<form id="admin_adder" action="{{ path('admin_collection_submit_order_admins', { 'bas_id' : bas_id }) }}" method="post" style="margin:0;">
@@ -143,7 +143,7 @@
<h5>{{ 'admin::base:collection: minilogo actuel' | trans }}</h5>
{% if collection.getLogo(bas_id, app) is not empty %}
<div class="thumbnail" style="width:120px;height:24px;margin-top:5px;margin-bottom:5px">{{ collection.getLogo(bas_id, app) | raw }}</div>
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<form method="post" action="{{ path('admin_collection_delete_logo', { 'bas_id' : bas_id }) }}" style="margin:0;">
<button class="btn btn-danger btn-mini" >
<i class="icon-trash icon-white"></i>
@@ -151,7 +151,7 @@
</button>
</form>
{% endif%}
{% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<span>{{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}</span>
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="{{ path('admin_collection_submit_logo', { 'bas_id' : bas_id }) }}" style="margin:0;">
<span class="btn btn-success fileinput-button">
@@ -168,7 +168,7 @@
<h5>{{ "Watermark" | trans }}</h5>
{% if collection.getWatermark(bas_id) is not empty %}
<div class="thumbnail">{{ collection.getWatermark(bas_id)| raw }}</div>
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<form method="post" action="{{ path('admin_collection_delete_watermark', { 'bas_id' : bas_id }) }}" style="margin:0;">
<button class="btn btn-danger btn-mini">
<i class="icon-trash icon-white"></i>
@@ -176,7 +176,7 @@
</button>
</form>
{% endif%}
{% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<span>{{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}</span>
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="{{ path('admin_collection_submit_watermark', { 'bas_id' : bas_id }) }}" style="margin:0;">
<span class="btn btn-success fileinput-button">
@@ -193,7 +193,7 @@
<h5>{{ "Stamp logo" | trans }}</h5>
{% if collection.getStamp(bas_id) is not empty %}
<div class="thumbnail" style="max-height:120px;max-width:260px">{{ collection.getStamp(bas_id)| raw }}</div>
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<form method="post" action="{{ path('admin_collection_delete_stamp', { 'bas_id' : bas_id }) }}" style="margin:0;">
<button class="btn btn-danger btn-mini">
<i class="icon-trash icon-white"></i>
@@ -201,7 +201,7 @@
</button>
</form>
{% endif%}
{% elseif app['acl'].get(app['authentication'].getUser()).has_right_on_base(bas_id, 'manage') %}
{% elseif app.getAclForUser(app.getAuthenticatedUser()).has_right_on_base(bas_id, 'manage') %}
<span>{{ 'admin::base:collection: aucun fichier (minilogo, watermark ...)' | trans }}</span>
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="{{ path('admin_collection_submit_stamp', { 'bas_id' : bas_id }) }}" style="margin:0;">
<span class="btn btn-success fileinput-button">

View File

@@ -32,10 +32,10 @@
</div>
<div class="control-group">
<div class="controls">
{% if app['acl'].get(app['authentication'].getUser()).get_granted_base(["canadmin"]) | length > 0 %}
{% if app.getAclForUser(app.getAuthenticatedUser()).get_granted_base(["canadmin"]) | length > 0 %}
<select id="othcollsel" name="othcollsel" disabled>
<option>{{ "choisir" | trans }}</option>
{% for collection in app['acl'].get(app['authentication'].getUser()).get_granted_base(["canadmin"]) %}
{% for collection in app.getAclForUser(app.getAuthenticatedUser()).get_granted_base(["canadmin"]) %}
<option value="{{ collection.get_base_id() }}">{{ collection.get_label(app['locale']) }}</option>
{% endfor %}
</select>