Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Change header color to yellow if impersonating

dominik-zeglend668c8b8d09b
diff --git a/saleor/settings.py b/saleor/settings.py
index ffdfdb2c24..160fd2eb6b 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -424,4 +424,3 @@ IMPERSONATE_GET_PARAM = 'impersonate'
IMPERSONATE_REDIRECT_URL = '/?action=' + IMPERSONATE_GET_PARAM
IMPERSONATE_USE_HTTP_REFERER = True
IMPERSONATE_CUSTOM_ALLOW = 'saleor.userprofile.utils.can_impersonate'
-
diff --git a/templates/base.html b/templates/base.html
index 2cf9302eaf..046e403ce9 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -28,7 +28,8 @@
<body>
{% block header %}
<header class="navbar" role="navigation">
- <div class="navbar__login d-none d-md-block container">
+ <div class="navbar__login container-fluid {% if user.is_impersonate %} bg-warning{% endif %}">
+ <div class=" d-none d-md-block container">
<div class="row">
<div class="col-6">
<p class="text-left">{{ site.settings.header_text }}</p>
@@ -36,7 +37,7 @@
<div class="col-6">
<ul class="float-right">
{% if user.is_authenticated %}
- {% if user.is_staff %}
+ {% if user.is_staff or request.impersonator.is_staff %}
<li>
<a href="{% url "dashboard:index" %}" target="_blank" rel="noopener">
{% trans "Dashboard" context "Main navigation item" %}
@@ -74,6 +75,7 @@
</div>
</div>
</div>
+ </div>
<div class="navbar__brand container-fluid d-block">
<div class="container">
<div class="row no-gutters">
diff --git a/templates/dashboard/customer/detail.html b/templates/dashboard/customer/detail.html
index e6c3f92914..bec99bad60 100644
--- a/templates/dashboard/customer/detail.html
+++ b/templates/dashboard/customer/detail.html
@@ -36,12 +36,12 @@
{% block header_extra %}
- {% if customer.pk and not customer.is_staff and perms.userprofile.edit_staff and perms.userprofile.edit_user perms.userprofile.impersonate_user %}
+ {% if customer.pk and not customer.is_staff and perms.userprofile.edit_staff and perms.userprofile.edit_user or perms.userprofile.impersonate_user %}
<a class="dropdown-button right" href="#" data-activates="context-menu" data-constrainwidth="false">
<svg data-src="{% static "dashboard/images/more_vert.svg" %}" height="24" width="24" />
</a>
<ul id="context-menu" class="dropdown-content">
- {% if customer.pk and not customer.is_staff and request.user.is_superuser %}
+ {% if perms.userprofile.edit_user %}
<li>
<a href="#base-modal" data-href="{% url 'dashboard:customer-promote' pk=customer.pk %}"
class="modal-trigger-custom">