Skip to content

Commit

Permalink
Do not display superuser menu items to staff user
Browse files Browse the repository at this point in the history
  • Loading branch information
dimasciput committed Oct 19, 2023
1 parent 273e31f commit 21e3d93
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 15 additions & 5 deletions bims/templates/fbis/navigation_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,19 @@ <h5 class="my-0 mr-md-auto font-weight-normal">
<a class="nav-login-button" href="/accounts/signup">SIGN UP</a>
{% else %}
<li class="dropdown dropdown-admin">
<a class="p-2 dropdown-toggle" data-toggle="dropdown" href="#">{{ request.user.first_name }}
<a class="p-2 dropdown-toggle" data-toggle="dropdown" href="#">
{% if request.user.first_name %}
{{ request.user.first_name }}
{% else %}
{{ request.user.username }}
{% endif %}
</a>
<ul class="dropdown-menu" style="width: 180px">
<li class="dropdown-menu-item"><a href="/profile/">Profile</a></li>
<li class="dropdown-menu-item"><a href="/site-visit/list/?&collectors=%5B{{ user.id }}%5D">Site Visits</a></li>
</ul>
</li>
{% if bims_preferences.enable_upload_data %}
<a class="p-2" href="/upload">Upload Data</a>
{% endif %}
{% if user.is_staff or user.is_superuser %}
{% if user.is_superuser %}
<li class="dropdown dropdown-admin">
<a class="p-2 dropdown-toggle" data-toggle="dropdown" href="#">Administration
</a>
Expand All @@ -127,6 +129,14 @@ <h5 class="my-0 mr-md-auto font-weight-normal">
<li class="dropdown-menu-item"><a href="https://analytics.google.com/analytics/web/" target="_blank">Analytics</a></li>
</ul>
</li>
{% elif user.is_staff %}
<li class="dropdown dropdown-admin">
<a class="p-2 dropdown-toggle" data-toggle="dropdown" href="#">Administration
</a>
<ul class="dropdown-menu" style="width: 250px; z-index: 9999">
<li class="dropdown-menu-item"><a href="/admin/">Admin Page</a></li>
</ul>
</li>
{% endif %}
{% if preferences.SiteSetting.default_data_source == 'fbis' %}
<li class="dropdown dropdown-admin">
Expand Down
4 changes: 3 additions & 1 deletion bims/templates/navigation_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<a class="dropdown-item" href="/profile/">Profile</a>
<a class="dropdown-item" href="/site-visit/list/?&collectors=%5B{{ user.id }}%5D">Site Visits</a>
<div class="dropdown-divider"></div>
{% if user.is_staff or user.is_superuser %}
{% if user.is_superuser %}
<div class="text-sm">Upload</div>
<a class="dropdown-item" href="/upload-taxa/">Taxonomic Data</a>
<a class="dropdown-item" href="/upload-collections/">Occurrence Data</a>
Expand All @@ -166,6 +166,8 @@
<a class="dropdown-item" href="/cms">Wagtail Admin</a>
<a class="dropdown-item" href="/backups-management">Backups</a>
<a class="dropdown-item" href="/summary-report">Summary Report</a>
{% elif user.is_staff %}
<a class="dropdown-item" href="/admin/">Admin Page</a>
{% endif %}
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/accounts/logout/">Log Out</a>
Expand Down

0 comments on commit 21e3d93

Please sign in to comment.