requireOwnership method

void requireOwnership(
  1. dynamic resourceOwnerId, [
  2. String? message
])

Requires ownership of a resource.

Implementation

void requireOwnership(dynamic resourceOwnerId, [String? message]) {
  requireAuth();
  if (!ownsResource(resourceOwnerId)) {
    throw AuthException(
      message ?? 'Access denied: not the owner',
      statusCode: 403,
    );
  }
}