Connectors

Google Drive connector

Shared drives, and that one doc everybody can open by accident.

In short

  • Exports Google Docs, Sheets and Slides from My Drive and shared drives through a service account with domain-wide delegation.
  • Modes: sync (Drive permissions and the Directory become readers) and fixed.

Setup

  1. Create a service account and enable domain-wide delegation for it.
  2. Authorize the OAuth scope https://www.googleapis.com/auth/drive.readonly; for sync also admin.directory.user.readonly and admin.directory.group.readonly, and name an administrator in settings.admin_email whom the sync impersonates for the Directory.
  3. Put the service-account key JSON in an environment variable.

Configuration

See shared configuration for installation, permission intervals, encryption keys and identity links.

[[sources]]
id = "drive"
type = "google-drive"
permissions = "sync"                     # or "fixed" with readers = [...]

[sources.settings]
service_account = { env = "FYRR_GDRIVE_SERVICE_ACCOUNT" }  # key JSON
admin_email = "admin@example.com"        # required for sync, unused for fixed

[sources.scope]
my_drive = true                          # files owned by the users below
shared_drives = ["*"]                    # "*" = every drive those users can open, or drive IDs
shared_with_me = false                   # files the users can open but do not own; fixed only
owners = ["a@example.com"]               # user e-mails; empty = all active users (sync only)
folders = []                             # folder IDs; empty = no folder restriction
extensions = ["gdoc", "gsheet", "gslides"]

Under fixed, scope.owners must list the users whose Drive is read. shared_with_me = true with a sync connection is refused, because another owner's permission list is not reliably readable. Widening the scope of a source that already synced needs fyrr writer sync --full.

Documents

Permissions

Permission snapshots are reused within a run; see source revocation timing.

Under sync, each in-scope file's complete permission list is read (inline when the API proves it complete, else fully paged) and mapped:

Drive permissionReaders
user with an e-mail, any roleusr:<email>; an address outside the domain links to nobody
groupgrp:<email>, members from the Directory snapshot
domain with file discovery allowedgrp:domain:<domain>
domain link-only; anyonenobody
deleted, expiring or view-restricted permissionsnobody
shared-drive membershipthe drive as a container grant, only when the API shows every member's access inherited from the drive and no limited-access folder sits above the file; otherwise membership grants are dropped (over-restricted)
unreadable or partial permission listthe permission pass fails (failure handling)

The member snapshot comes from the Directory: users by lower-cased primary e-mail, marked verified corporate (so they link to the canonical directory automatically), inactive when suspended or archived; groups with direct user and group members; and one synthetic domain:<domain> group per domain. Feeds are read for active users only.

Under fixed, no Directory or permission call is made and the users are exactly scope.owners.

Limits

Edit this page on GitHub ↗