oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

1package main
2
3import (
4 "context"
5 "github.com/carlosframework/docs/internal/docs"
6 "github.com/carlosframework/docs/internal/docs/linkstore"
7 p "github.com/carlosframework/docs/internal/docs/principalstore"
8 "amadan.net/rastrillo/rastrillo/db"
9 "amadan.net/rastrillo/rastrillo/migrate"
10)
11
12// openProbeDB lives in the step file because the old and new trees import
13// rastrillo's db from different module paths.
14func openProbeDB(path string) (*db.DB, error) { return db.Open(path, nil) }
15
16func principalStep(ctx context.Context, d *db.DB, phase string) int64 {
17 _, e := migrate.Apply(ctx, d, migrate.Merge(linkstore.Schema, p.Schema))
18 must(e)
19 s, e := p.New(d.Writer(), p.Config{Issuer: "https://id.oficina.works", Team: "A1", RequireMembership: func(context.Context, p.MembershipRequest) error { return nil }})
20 must(e)
21 v, e := s.EnsureHome(ctx, p.HomeIdentity{Issuer: "https://id.oficina.works", Subject: "synthetic-member"})
22 must(e)
23 if v.VerifiedAddress != nil {
24 panic("invented address")
25 }
26 return v.ID
27}
28
29func fixtureActor(id int64, address string) docs.Actor {
30 return docs.Actor{PersonID: id, VerifiedAddress: &address}
31}
32