fga-eps-mds/2020.2-Hortum

View on GitHub
src/hortum/customer/permissions.py

Summary

Maintainability
A
0 mins
Test Coverage
from rest_framework import permissions

from .models import Customer

class IsCustomer(permissions.BasePermission):
    message = 'Usuário não é um consumidor.'

    def has_permission(self, request, view):
        return Customer.objects.filter(user__email=request.user).exists()