Skip to content

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

Update impersonate permission description

Pacu2470c28f1bad7
diff --git a/saleor/account/impersonate.py b/saleor/account/impersonate.py
index 470180b023..78b479f17f 100644
--- a/saleor/account/impersonate.py
+++ b/saleor/account/impersonate.py
@@ -13,4 +13,4 @@ def can_impersonate(request):
`django-impersonate` module requires a function as input argument,
not just permission name.
"""
- return request.user.has_perm('account.impersonate_user')
+ return request.user.has_perm('account.impersonate_users')
diff --git a/saleor/account/models.py b/saleor/account/models.py
index 25eccf3226..ede3000183 100644
--- a/saleor/account/models.py
+++ b/saleor/account/models.py
@@ -130,11 +130,11 @@ class User(PermissionsMixin, AbstractBaseUser):
('manage_users',
pgettext_lazy(
'Permission description',
- 'View, create, modify, and delete customers.')),
+ 'Capability to view, create, modify, and delete customers.')),
('manage_staff', pgettext_lazy(
'Permission description',
- 'View, create, modify and delete staff users.')),
- ('impersonate_user',
+ 'Capability to view, create, modify and delete staff users.')),
+ ('impersonate_users',
pgettext_lazy(
'Permission description',
'Capability to impersonate the customers.')))
diff --git a/saleor/core/permissions.py b/saleor/core/permissions.py
index cd9bdc7379..ed7cecb1f8 100644
--- a/saleor/core/permissions.py
+++ b/saleor/core/permissions.py
@@ -3,7 +3,7 @@ from django.contrib.auth.models import Permission
MODELS_PERMISSIONS = [
'account.manage_users',
'account.manage_staff',
- 'account.impersonate_user',
+ 'account.impersonate_users',
'discount.manage_discounts',
'menu.manage_menus',
'order.manage_orders',
diff --git a/saleor/discount/models.py b/saleor/discount/models.py
index 2baaae10a7..58b46a9194 100644
--- a/saleor/discount/models.py
+++ b/saleor/discount/models.py
@@ -146,7 +146,8 @@ class Sale(models.Model):
permissions = ((
'manage_discounts', pgettext_lazy(
'Permission description',
- 'View, create, modify, and delete sales and vouchers.')),)
+ 'Capability to view, create, modify, and delete sales and '
+ 'vouchers.')),)
def __repr__(self):
return 'Sale(name=%r, value=%r, type=%s)' % (
diff --git a/saleor/menu/models.py b/saleor/menu/models.py
index c3f87c5f48..b2cd256ef7 100644
--- a/saleor/menu/models.py
+++ b/saleor/menu/models.py
@@ -15,7 +15,7 @@ class Menu(models.Model):
permissions = ((
'manage_menus', pgettext_lazy(
'Permission description',
- 'Create, view, modify, and delete menus.')),)
+ 'Capability to view, create, modify, and delete menus.')),)
def __str__(self):
return self.name
diff --git a/saleor/page/models.py b/saleor/page/models.py
index 7d6bd78f01..98e6353418 100644
--- a/saleor/page/models.py
+++ b/saleor/page/models.py
@@ -32,7 +32,7 @@ class Page(SeoModel):
permissions = ((
'manage_pages', pgettext_lazy(
'Permission description',
- 'Create, modify, and delete pages.')),)
+ 'Capability to create, modify, and delete pages.')),)
def __str__(self):
return self.title
diff --git a/saleor/product/models.py b/saleor/product/models.py
index ab557d6d18..3be47f5aae 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -112,8 +112,8 @@ class Product(SeoModel):
permissions = ((
'manage_products', pgettext_lazy(
'Permission description',
- 'View, create, and modify products, collections, '
- 'and categories. Access to inventory and inventory '
+ 'Capability to view, create, and modify products, collections,'
+ ' and categories. Access to inventory and inventory '
'management.')),)
def __iter__(self):
diff --git a/saleor/shipping/models.py b/saleor/shipping/models.py
index b2175f23dd..51e2941d0d 100644
--- a/saleor/shipping/models.py
+++ b/saleor/shipping/models.py
@@ -23,7 +23,8 @@ class ShippingMethod(models.Model):
permissions = ((
'manage_shipping', pgettext_lazy(
'Permission description',
- 'Create, modify, and delete shipping methods.')),)
+ 'Capability to view, create, modify, and delete shipping '
+ 'methods.')),)
def __str__(self):
return self.name
diff --git a/saleor/site/models.py b/saleor/site/models.py
index 3062f3a9d7..9ce459e05f 100644
--- a/saleor/site/models.py
+++ b/saleor/site/models.py
@@ -28,7 +28,7 @@ class SiteSettings(models.Model):
permissions = ((
'manage_settings', pgettext_lazy(
'Permission description',
- 'View and modify the settings section.')),)
+ 'Capability to view and modify the settings section.')),)
def __str__(self):
return self.site.name
diff --git a/templates/dashboard/customer/detail.html b/templates/dashboard/customer/detail.html
index bacd89ad09..40d65aa680 100644
--- a/templates/dashboard/customer/detail.html
+++ b/templates/dashboard/customer/detail.html
@@ -76,7 +76,7 @@
<a href="#base-modal" data-href="{% url 'dashboard:customer-delete' pk=customer.pk %}" class="modal-trigger-custom btn-flat waves-effect">
{% trans "Remove customer" context "Customer action" %}
</a>
- {% if perms.account.impersonate_user %}
+ {% if perms.account.impersonate_users %}
<a href="{% url 'impersonate-start' uid=customer.pk %}" class="btn-flat waves-effect">
{% trans 'Impersonate customer' context 'Customer impersonate action' %}
</a>
diff --git a/tests/conftest.py b/tests/conftest.py
index b2d76bb6fc..a0fb3a0aa5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -572,8 +572,8 @@ def permission_manage_settings():
@pytest.fixture
-def permission_impersonate_user():
- return Permission.objects.get(codename='impersonate_user')
+def permission_impersonate_users():
+ return Permission.objects.get(codename='impersonate_users')
@pytest.fixture
diff --git a/tests/test_impersonation.py b/tests/test_impersonation.py
index 67881f0b8a..f3959da033 100644
--- a/tests/test_impersonation.py
+++ b/tests/test_impersonation.py
@@ -6,8 +6,8 @@ from saleor.account.models import User
def test_staff_with_permission_can_impersonate(
- staff_client, customer_user, staff_user, permission_impersonate_user):
- staff_user.user_permissions.add(permission_impersonate_user)
+ staff_client, customer_user, staff_user, permission_impersonate_users):
+ staff_user.user_permissions.add(permission_impersonate_users)
staff_user = User.objects.get(pk=staff_user.pk)
response = staff_client.get(reverse('impersonate-start',
args=[customer_user.pk]), follow=True)