initial commit

This commit is contained in:
2025-08-05 10:26:39 +05:00
commit b7412bbef6
298 changed files with 10533 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
from rest_framework import permissions # type: ignore
from rest_framework.views import APIView # type: ignore
from rest_framework.request import HttpRequest # type: ignore
from core.apps.companies.models import (
CompanyAccountModel,
CompanyModel
)
class IsCompanyAccount(permissions.IsAuthenticated):
def has_object_permission( # type: ignore
self,
request: HttpRequest,
view: APIView,
obj: CompanyModel
) -> bool:
if request.user.is_staff:
return True
return CompanyAccountModel.objects.filter(
company=obj, user=request.user,
).exists()