rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {

    match /users/{userId}/{imageId} {
      allow read: if true;
      allow write: if request.auth != null
                   && request.auth.uid == userId
                   && request.resource.size < 1024 * 1024
                   && request.resource.contentType.matches('image/.*');
    }

    match /projects/{projectId}/{imageId} {
      allow read: if true;
      allow write: if false;
    }

  }
}
