MCPcopy
hub / github.com/pocketbase/pocketbase / NewAuthOrigin

Function NewAuthOrigin

core/auth_origin_model.go:36–49  ·  view source on GitHub ↗

NewAuthOrigin instantiates and returns a new blank *AuthOrigin model. Example usage: origin := core.NewOrigin(app) origin.SetRecordRef(user.Id) origin.SetCollectionRef(user.Collection().Id) origin.SetFingerprint("...") app.Save(origin)

(app App)

Source from the content-addressed store, hash-verified

34// origin.SetFingerprint("...")
35// app.Save(origin)
36func NewAuthOrigin(app App) *AuthOrigin {
37 m := &AuthOrigin{}
38
39 c, err := app.FindCachedCollectionByNameOrId(CollectionNameAuthOrigins)
40 if err != nil {
41 // this is just to make tests easier since authOrigins is a system collection and it is expected to be always accessible
42 // (note: the loaded record is further checked on AuthOrigin.PreValidate())
43 c = NewBaseCollection("@___invalid___")
44 }
45
46 m.Record = NewRecord(c)
47
48 return m
49}
50
51// PreValidate implements the [PreValidator] interface and checks
52// whether the proxy is properly loaded.

Callers 10

TestNewAuthOriginFunction · 0.92
TestAuthOriginRecordRefFunction · 0.92
TestAuthOriginCreatedFunction · 0.92
TestAuthOriginUpdatedFunction · 0.92
authAlertFunction · 0.92
TestRecordCrudUpdateFunction · 0.92

Calls 3

NewBaseCollectionFunction · 0.85
NewRecordFunction · 0.85

Tested by 9

TestNewAuthOriginFunction · 0.74
TestAuthOriginRecordRefFunction · 0.74
TestAuthOriginCreatedFunction · 0.74
TestAuthOriginUpdatedFunction · 0.74
TestRecordCrudUpdateFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…