code: def has_permission(self, request, view):
          
          if not self.global_permissions:
              return True
  
          serializer_class = view.get_serializer_class()
  
          assert serializer_class.Meta.model is not None, (
              "global_permissions set to true without a model "
              "set on the serializer for '%s'" % view.__class__.__name__
          )
  
          model_class = serializer_class.Meta.model
  
          action_method_name = None
          if hasattr(view, 'action'):
              action = self._get_action(view.action)
              action_method_name = "has_{action}_permission".format(action=action)
              # If the specific action permission exists then use it, otherwise use general.
              if hasattr(model_class, action_method_name):
                  return getattr(model_class, action_method_name)(request)
  
          if request.method in permissions.SAFE_METHODS:
              assert hasattr(model_class, 'has_read_permission'), \
                  self._get_error_message(model_class, 'has_read_permission', action_method_name)
              return model_class.has_read_permission(request)
          else:
              assert hasattr(model_class, 'has_write_permission'), \
                  self._get_error_message(model_class, 'has_write_permission', action_method_name)
              return model_class.has_write_permission(request)
docs: Overrides the standard function and figures out methods to call for global permissions.