style(pos): улучшить адаптивность сетки товаров
- Изменить брейкпоинт для 5 колонок с 992px на 1100px - Увеличить ширину правой панели с 4/12 до 5/12 колонок Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1200,6 +1200,7 @@ def create_category_api(request):
|
||||
}, status=500)
|
||||
|
||||
|
||||
@login_required
|
||||
def update_product_price_api(request, pk):
|
||||
"""
|
||||
AJAX endpoint для изменения цены товара (inline editing в каталоге).
|
||||
@@ -1224,8 +1225,20 @@ def update_product_price_api(request, pk):
|
||||
'error': 'Метод не поддерживается'
|
||||
}, status=405)
|
||||
|
||||
# Проверка прав доступа
|
||||
if not request.user.has_perm('products.change_product'):
|
||||
# Проверка прав доступа через кастомную систему ролей
|
||||
from user_roles.services import RoleService
|
||||
|
||||
# Добавляем отладочное логирование
|
||||
try:
|
||||
logger.info(f"Update price API - User: {request.user.email}, is_superuser: {request.user.is_superuser}")
|
||||
user_role = RoleService.get_user_role(request.user)
|
||||
logger.info(f"Update price API - User role: {user_role.code if user_role else 'None'}")
|
||||
except Exception as e:
|
||||
logger.error(f"Update price API - Error getting user role: {str(e)}")
|
||||
|
||||
# Owner и Manager имеют право изменять цены
|
||||
if not request.user.is_superuser and not RoleService.user_has_role(request.user, 'owner', 'manager'):
|
||||
logger.warning(f"Update price API - Access denied for user {request.user.email}")
|
||||
return JsonResponse({
|
||||
'success': False,
|
||||
'error': 'У вас нет прав для изменения цен товаров'
|
||||
|
||||
Reference in New Issue
Block a user