<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_object_permission(self, request, view, obj):
 """ Allow staff or superusers, and the owner of the object itself. """

        user = request.user
        if not user.is_authenticated:
            return False
        elif user.is_staff or user.is_superuser:
            return True
        return user == obj.user