mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-04 23:33:06 +00:00
Collection privada archivePhoto (flickrId unique+index, metadados do Flickr + EXIF, leitura pela comunicação, mutação admin, entrada no mapa S3) com migration aditiva add_archive_photo; ingestão idempotente (transação + upload) e CLI pnpm flickr:import (plano dry-run por padrão, --apply com intenção/TEQO_ENV/S3, --verify inventário read-only, recibos JSON em data/flickr/reports). Guard de alvo extraído de reel-ingest para scripts/lib/cli.mjs; downloadUrlToFile ganha headers (User-Agent do Flickr).
23 lines
1 KiB
TypeScript
23 lines
1 KiB
TypeScript
// ---------------------------------------------------------------------------
|
|
// C231 — Flickr photo archive
|
|
// ---------------------------------------------------------------------------
|
|
|
|
import type { Access } from 'payload'
|
|
|
|
import { canReadCommunicationCatalog } from '@/lib/campaignRoles'
|
|
import { getFreshCampaignUser, isPayloadAdmin } from '@/utilities/access/shared'
|
|
|
|
/**
|
|
* Readers of the photo archive: Payload admin or campaign users with the
|
|
* `communicator`, `coordinator` or `candidate` role — the same vertical gate as
|
|
* the acervo de falas, the reels and the Central. Advisors and leaders are
|
|
* denied (fail-closed): the raw archive is editorial material, not a
|
|
* municipality-scoped staff area. C232 curates these same rows; the CLI
|
|
* ingests with an explicit documented bypass.
|
|
*/
|
|
export const canReadArchivePhoto: Access = async ({ req }) => {
|
|
if (isPayloadAdmin(req.user)) return true
|
|
|
|
const currentUser = await getFreshCampaignUser(req)
|
|
return currentUser ? canReadCommunicationCatalog(currentUser.role) : false
|
|
}
|