from rest_framework import permissions
class MyPers(permissions.IsAuthenticatedOrReadOnly):
    def has_object_permission(self, request, view, obj):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser       
    
    def has_permission(self, request, view):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser    

class MyPers2(permissions.IsAuthenticatedOrReadOnly):
    def has_object_permission(self, request, view, obj):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id

7957d3c7d93f61971c53d39abe042af31951227d
<mask token>


class MyPers(permissions.IsAuthenticatedOrReadOnly):
    <mask token>
    <mask token>


class MyPers2(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id

<mask token>


class MyPers(permissions.IsAuthenticatedOrReadOnly):
    <mask token>

    def has_permission(self, request, view):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser


class MyPers2(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id

<mask token>


class MyPers(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser

    def has_permission(self, request, view):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser


class MyPers2(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id

from rest_framework import permissions


class MyPers(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser

    def has_permission(self, request, view):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser


class MyPers2(permissions.IsAuthenticatedOrReadOnly):

    def has_object_permission(self, request, view, obj):
        if request.method in ['GET', 'OPTIONS']:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id

from rest_framework import permissions
class MyPers(permissions.IsAuthenticatedOrReadOnly):
    def has_object_permission(self, request, view, obj):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser       
    
    def has_permission(self, request, view):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser    

class MyPers2(permissions.IsAuthenticatedOrReadOnly):
    def has_object_permission(self, request, view, obj):
        if request.method in ["GET", "OPTIONS"]:
            return True
        return request.user.is_superuser or obj.user.id == request.user.id
