@@ -261,7 +261,7 @@ protected virtual void PrepareCustomerModelForEdit(CustomerModel model, Customer
261
261
model . LastActivityDate = Services . DateTimeHelper . ConvertToUserTime ( customer . LastActivityDateUtc , DateTimeKind . Utc ) ;
262
262
model . LastIpAddress = model . LastIpAddress ;
263
263
model . LastVisitedPage = customer . GetAttribute < string > ( SystemCustomerAttributeNames . LastVisitedPage ) ;
264
-
264
+
265
265
foreach ( var tzi in Services . DateTimeHelper . GetSystemTimeZones ( ) )
266
266
{
267
267
model . AvailableTimeZones . Add ( new SelectListItem { Text = tzi . DisplayName , Value = tzi . Id , Selected = tzi . Id == model . TimeZoneId } ) ;
@@ -635,6 +635,12 @@ public ActionResult Edit(CustomerModel model, bool continueEditing, FormCollecti
635
635
return RedirectToAction ( "List" ) ;
636
636
}
637
637
638
+ if ( customer . IsAdmin ( ) && ! Services . WorkContext . CurrentCustomer . IsAdmin ( ) )
639
+ {
640
+ NotifyError ( T ( "Admin.Customers.CustomerRoles.OnlyAdminsAllowed" ) ) ;
641
+ return RedirectToAction ( "Edit" , new { customer . Id } ) ;
642
+ }
643
+
638
644
// Validate customer roles.
639
645
var allowManagingCustomerRoles = Services . Permissions . Authorize ( Permissions . Customer . EditRole ) ;
640
646
@@ -906,11 +912,11 @@ public ActionResult Impersonate(int id)
906
912
if ( customer == null )
907
913
return RedirectToAction ( "List" ) ;
908
914
909
- // ensure that a non-admin user cannot impersonate as an administrator
910
- // otherwise , that user can simply impersonate as an administrator and gain additional administrative privileges
915
+ // Ensure that a non-admin user cannot impersonate as an administrator
916
+ // Otherwise , that user can simply impersonate as an administrator and gain additional administrative privileges
911
917
if ( ! Services . WorkContext . CurrentCustomer . IsAdmin ( ) && customer . IsAdmin ( ) )
912
918
{
913
- NotifyError ( "A non-admin user cannot impersonate as an administrator" ) ;
919
+ NotifyError ( T ( "Admin.Customers.CustomerRoles.OnlyAdminsAllowed" ) ) ;
914
920
return RedirectToAction ( "Edit" , customer . Id ) ;
915
921
}
916
922
@@ -1207,7 +1213,7 @@ private void PrepareAddressModel(CustomerAddressModel model, Customer customer,
1207
1213
model . Address . LastNameRequired = true ;
1208
1214
model . Address . EmailEnabled = true ;
1209
1215
model . Address . EmailRequired = true ;
1210
-
1216
+
1211
1217
MiniMapper . Map ( _addressSettings , model . Address ) ;
1212
1218
1213
1219
model . Address . AvailableCountries = _countryService . GetAllCountries ( true )
0 commit comments