winofy-backend/apps/core/permissions.py
Ali Asadi 52adc732fa Initial Winofy backend: marketplace core (no payment integration)
Django 6 + DRF resource server against the Gooyal accounts OAuth2 service,
matching the Winsoo ecosystem's conventions. Covers locations, stores,
catalog, cart, checkout/orders (with the multi-store-cart split and the
status stepper), reviews, and notifications, plus a demo-data seed command.

Payment integration (wallet debits, online gateway, seller payouts) is
intentionally left out here — see feature/payment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 14:03:15 +03:30

10 lines
393 B
Python

from rest_framework.permissions import BasePermission
class IsStoreOwner(BasePermission):
"""Restricts seller-panel endpoints to authenticated users who own a Store."""
message = "شما فروشگاهی ثبت نکرده‌اید."
def has_permission(self, request, view):
return bool(request.user and request.user.is_authenticated and hasattr(request.user, 'store'))