Skip to content

Commit b0215c0

Browse files
committed
Refactor security scan link visibility based on user permissions
1 parent 6c3d56a commit b0215c0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

qgis-app/plugins/templates/plugins/plugin_detail.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,41 +264,40 @@ <h2>
264264
</div>
265265
<p class="plugin-details-description">{{ object.description|linebreaksbr }}</p>
266266
<div id="rating"> (<span id="votes">{% firstof votes '0' %}</span>) {% trans "votes" %}&nbsp;<span id="loading" style="display:none">Loading...</span><span id="vote-message" style="display:none"></span></div>
267-
{% if user.is_staff or user in object.editors %}
268-
<div>
267+
<div>
269268
{% with release=object.stable|default:object.experimental %}
270269
{% if release %}
271270
{% with security_scan=release.security_scan %}
272271
{% if security_scan.overall_status == 'passed' %}
273-
<a href="{{ release.get_absolute_url }}#security-tab" class="button is-small is-rounded is-success">
272+
<a {% if user.is_staff or user in object.editors %}href="{{ release.get_absolute_url }}#security-tab"{% endif %} class="button is-small is-rounded is-success">
274273
<span class="icon is-small">
275274
<i class="fas fa-shield-halved"></i>
276275
</span>
277276
<span>{% trans "Security scan passed (latest)" %}</span>
278277
</a>
279278
{% elif security_scan.overall_status == 'critical' %}
280-
<a href="{{ release.get_absolute_url }}#security-tab" class="button is-small is-rounded is-danger">
279+
<a {% if user.is_staff or user in object.editors %}href="{{ release.get_absolute_url }}#security-tab"{% endif %} class="button is-small is-rounded is-danger">
281280
<span class="icon is-small">
282281
<i class="fas fa-triangle-exclamation"></i>
283282
</span>
284283
<span>{% trans "Security issue detected (latest)" %}</span>
285284
</a>
286285
{% elif security_scan.overall_status == 'warning' %}
287-
<a href="{{ release.get_absolute_url }}#security-tab" class="button is-small is-rounded is-warning">
286+
<a {% if user.is_staff or user in object.editors %}href="{{ release.get_absolute_url }}#security-tab"{% endif %} class="button is-small is-rounded is-warning">
288287
<span class="icon is-small">
289288
<i class="fas fa-circle-exclamation"></i>
290289
</span>
291290
<span>{% trans "Potential security issue (latest)" %}</span>
292291
</a>
293292
{% elif security_scan.overall_status == 'info' %}
294-
<a href="{{ release.get_absolute_url }}#security-tab" class="button is-small is-rounded is-info">
293+
<a {% if user.is_staff or user in object.editors %}href="{{ release.get_absolute_url }}#security-tab"{% endif %} class="button is-small is-rounded is-info">
295294
<span class="icon is-small">
296295
<i class="fas fa-info"></i>
297296
</span>
298297
<span>{% trans "Scanned with informational items (latest)" %}</span>
299298
</a>
300299
{% else %}
301-
<a href="{{ release.get_absolute_url }}#security-tab" class="button is-small is-rounded is-light">
300+
<a {% if user.is_staff or user in object.editors %}href="{{ release.get_absolute_url }}#security-tab"{% endif %} class="button is-small is-rounded is-light">
302301
<span class="icon is-small">
303302
<i class="fas fa-circle-question"></i>
304303
</span>
@@ -309,7 +308,6 @@ <h2>
309308
{% endif %}
310309
{% endwith %}
311310
</div>
312-
{% endif %}
313311
<a class="button mt-3" href="{% if object.stable %}{{ object.stable.get_download_url }}{% else %}{{ object.experimental.get_download_url }}{% endif %}">
314312
<i class="fas fa-download" style="vertical-align: middle;"></i>&nbsp;{% trans "Download latest" %}
315313
</a>

0 commit comments

Comments
 (0)