Add Read and ReadWrite when getting data.

This allows implementations to prevent race conditions between
contentious objects.
このコミットが含まれているのは:
Cory Slep 2018-05-27 22:57:43 +02:00
コミット 96c9afee84
6個のファイルの変更226行の追加113行の削除

ファイルの表示

@ -202,7 +202,7 @@ func (f *federator) GetInbox(c context.Context, w http.ResponseWriter, r *http.R
if !isActivityPubGet(r) {
return false, nil
}
oc, err := f.App.GetInbox(c, r)
oc, err := f.App.GetInbox(c, r, Read)
if err != nil {
return true, err
}
@ -324,7 +324,7 @@ func (f *federator) GetOutbox(c context.Context, w http.ResponseWriter, r *http.
if !isActivityPubGet(r) {
return false, nil
}
oc, err := f.App.GetOutbox(c, r)
oc, err := f.App.GetOutbox(c, r, Read)
if err != nil {
return true, err
}
@ -483,7 +483,7 @@ func (f *federator) handleClientUpdate(c context.Context, rawJson map[string]int
return fmt.Errorf("update has no id: %v", s)
}
for idx, id := range ids {
pObj, err := f.App.Get(c, id)
pObj, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -531,7 +531,7 @@ func (f *federator) handleClientDelete(c context.Context, deliverable *bool) fun
return fmt.Errorf("delete has no id: %v", s)
}
for _, id := range ids {
pObj, err := f.App.Get(c, id)
pObj, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -598,7 +598,7 @@ func (f *federator) handleClientAdd(c context.Context, deliverable *bool) func(s
if !f.App.Owns(c, id) {
continue
}
target, err := f.App.Get(c, id)
target, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -662,7 +662,7 @@ func (f *federator) handleClientRemove(c context.Context, deliverable *bool) fun
if !f.App.Owns(c, id) {
continue
}
target, err := f.App.Get(c, id)
target, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -708,7 +708,7 @@ func (f *federator) handleClientLike(ctx context.Context, deliverable *bool) fun
}
getter := func(actor vocab.ObjectType, lc *vocab.CollectionType, loc *vocab.OrderedCollectionType) (bool, error) {
if actor.IsLikedAnyURI() {
pObj, err := f.App.Get(ctx, actor.GetLikedAnyURI())
pObj, err := f.App.Get(ctx, actor.GetLikedAnyURI(), ReadWrite)
if err != nil {
return true, err
}
@ -834,7 +834,7 @@ func (f *federator) handleDelete(c context.Context) func(s *streams.Delete) erro
return fmt.Errorf("delete has no id: %v", s)
}
for _, id := range ids {
pObj, err := f.App.Get(c, id)
pObj, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -881,7 +881,7 @@ func (f *federator) handleFollow(c context.Context, inboxURL url.URL) func(s *st
if todo == AutomaticAccept {
getter := func(object vocab.ObjectType, lc *vocab.CollectionType, loc *vocab.OrderedCollectionType) (bool, error) {
if object.IsFollowersAnyURI() {
pObj, err := f.App.Get(c, object.GetFollowersAnyURI())
pObj, err := f.App.Get(c, object.GetFollowersAnyURI(), ReadWrite)
if err != nil {
return true, err
}
@ -937,7 +937,7 @@ func (f *federator) handleAccept(c context.Context) func(s *streams.Accept) erro
}
getter := func(actor vocab.ObjectType, lc *vocab.CollectionType, loc *vocab.OrderedCollectionType) (bool, error) {
if actor.IsFollowingAnyURI() {
pObj, err := f.App.Get(c, actor.GetFollowingAnyURI())
pObj, err := f.App.Get(c, actor.GetFollowingAnyURI(), ReadWrite)
if err != nil {
return true, err
}
@ -1003,7 +1003,7 @@ func (f *federator) handleAdd(c context.Context) func(s *streams.Add) error {
if !f.App.Owns(c, id) {
continue
}
target, err := f.App.Get(c, id)
target, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -1067,7 +1067,7 @@ func (f *federator) handleRemove(c context.Context) func(s *streams.Remove) erro
if !f.App.Owns(c, id) {
continue
}
target, err := f.App.Get(c, id)
target, err := f.App.Get(c, id, ReadWrite)
if err != nil {
return err
}
@ -1111,7 +1111,7 @@ func (f *federator) handleLike(c context.Context) func(s *streams.Like) error {
}
getter := func(object vocab.ObjectType, lc *vocab.CollectionType, loc *vocab.OrderedCollectionType) (bool, error) {
if object.IsLikesAnyURI() {
pObj, err := f.App.Get(c, object.GetLikesAnyURI())
pObj, err := f.App.Get(c, object.GetLikesAnyURI(), ReadWrite)
if err != nil {
return true, err
}

ファイルの表示

@ -556,12 +556,12 @@ var _ Application = &MockApplication{}
type MockApplication struct {
t *testing.T
owns func(c context.Context, id url.URL) bool
get func(c context.Context, id url.URL) (PubObject, error)
getAsVerifiedUser func(c context.Context, id, authdUser url.URL) (PubObject, error)
get func(c context.Context, id url.URL, rw RWType) (PubObject, error)
getAsVerifiedUser func(c context.Context, id, authdUser url.URL, rw RWType) (PubObject, error)
has func(c context.Context, id url.URL) (bool, error)
set func(c context.Context, o PubObject) error
getInbox func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error)
getOutbox func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error)
getInbox func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error)
getOutbox func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error)
newId func(c context.Context, t Typer) url.URL
getPublicKey func(c context.Context, publicKeyId string) (crypto.PublicKey, httpsig.Algorithm, url.URL, error)
}
@ -573,18 +573,18 @@ func (m *MockApplication) Owns(c context.Context, id url.URL) bool {
return m.owns(c, id)
}
func (m *MockApplication) Get(c context.Context, id url.URL) (PubObject, error) {
func (m *MockApplication) Get(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if m.get == nil {
m.t.Fatal("unexpected call to MockApplication Get")
}
return m.get(c, id)
return m.get(c, id, rw)
}
func (m *MockApplication) GetAsVerifiedUser(c context.Context, id, authdUser url.URL) (PubObject, error) {
func (m *MockApplication) GetAsVerifiedUser(c context.Context, id, authdUser url.URL, rw RWType) (PubObject, error) {
if m.getAsVerifiedUser == nil {
m.t.Fatal("unexpected call to MockApplication GetAsVerifiedUser")
}
return m.getAsVerifiedUser(c, id, authdUser)
return m.getAsVerifiedUser(c, id, authdUser, rw)
}
func (m *MockApplication) Has(c context.Context, id url.URL) (bool, error) {
@ -601,18 +601,18 @@ func (m *MockApplication) Set(c context.Context, o PubObject) error {
return m.set(c, o)
}
func (m *MockApplication) GetInbox(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
func (m *MockApplication) GetInbox(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if m.getInbox == nil {
m.t.Fatal("unexpected call to MockApplication GetInbox")
}
return m.getInbox(c, r)
return m.getInbox(c, r, rw)
}
func (m *MockApplication) GetOutbox(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
func (m *MockApplication) GetOutbox(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if m.getOutbox == nil {
m.t.Fatal("unexpected call to MockApplication GetOutbox")
}
return m.getOutbox(c, r)
return m.getOutbox(c, r, rw)
}
func (m *MockApplication) NewId(c context.Context, t Typer) url.URL {
@ -948,7 +948,10 @@ func PreparePostInboxTest(t *testing.T, app *MockApplication, socialApp *MockSoc
fedApp.unblocked = func(c context.Context, actorIRIs []url.URL) error {
return nil
}
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
return oc, nil
@ -982,7 +985,10 @@ func PreparePostOutboxTest(t *testing.T, app *MockApplication, socialApp *MockSo
app.newId = func(c context.Context, t Typer) url.URL {
return *testNewIRI
}
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
return oc, nil
@ -1041,7 +1047,10 @@ func TestSocialPubber_GetInbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testInboxURI, nil))
gotInbox := 0
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotInbox++
return testSingleOrderedCollection, nil
}
@ -1087,7 +1096,10 @@ func TestSocialPubber_PostOutbox(t *testing.T) {
return *testNewIRI
}
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotOutbox++
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
@ -1181,7 +1193,10 @@ func TestSocialPubber_PostOutbox_SocialAPIVerified(t *testing.T) {
return *testNewIRI
}
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotOutbox++
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
@ -1251,7 +1266,10 @@ func TestSocialPubber_GetOutbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testOutboxURI, nil))
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotOutbox++
return testSingleOrderedCollection, nil
}
@ -1285,7 +1303,10 @@ func TestFederatingPubber_PostInbox(t *testing.T) {
return nil
}
gotInbox := 0
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotInbox++
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
@ -1318,7 +1339,10 @@ func TestFederatingPubber_PostInbox(t *testing.T) {
}
gotGet := 0
var gotIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotGet++
gotIri = iri
return samActor, nil
@ -1371,7 +1395,10 @@ func TestFederatingPubber_GetInbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testInboxURI, nil))
gotInbox := 0
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotInbox++
return testSingleOrderedCollection, nil
}
@ -1412,7 +1439,10 @@ func TestFederatingPubber_GetOutbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testOutboxURI, nil))
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotOutbox++
return testSingleOrderedCollection, nil
}
@ -1446,7 +1476,10 @@ func TestPubber_PostInbox(t *testing.T) {
return nil
}
gotInbox := 0
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotInbox++
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
@ -1479,7 +1512,10 @@ func TestPubber_PostInbox(t *testing.T) {
}
gotGet := 0
var gotIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotGet++
gotIri = iri
return samActor, nil
@ -1532,7 +1568,10 @@ func TestPubber_GetInbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testInboxURI, nil))
gotInbox := 0
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotInbox++
return testSingleOrderedCollection, nil
}
@ -1594,7 +1633,10 @@ func TestPubber_PostOutbox(t *testing.T) {
return *testNewIRI
}
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotOutbox++
oc := &vocab.OrderedCollection{}
oc.AppendType("OrderedCollection")
@ -1737,7 +1779,10 @@ func TestPubber_GetOutbox(t *testing.T) {
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testOutboxURI, nil))
gotOutbox := 0
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
}
gotOutbox++
return testSingleOrderedCollection, nil
}
@ -1963,7 +2008,7 @@ func TestPostInbox_DoesNotAddToInboxIfDuplicate(t *testing.T) {
gotSet++
return nil
}
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
inbox := &vocab.OrderedCollection{}
inbox.AppendOrderedItemsIRI(*noteActivityIRI)
return inbox, nil
@ -2166,8 +2211,10 @@ func TestPostInbox_Delete_FetchesObject(t *testing.T) {
PreparePostInboxTest(t, app, socialApp, fedApp, socialCb, fedCb, d, httpClient, p)
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("POST", testInboxURI, bytes.NewBuffer(MustSerialize(testDeleteNote))))
app.get = func(c context.Context, id url.URL) (PubObject, error) {
if id != *noteIRI {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
} else if id != *noteIRI {
t.Fatalf("expected %s, got %s", noteIRI, id)
}
return testNote, nil
@ -2296,7 +2343,7 @@ func TestPostInbox_Delete_SetsTombstone(t *testing.T) {
}
for _, test := range tests {
t.Logf("Running table test case %q", test.name)
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
return test.input(), nil
}
gotSet = 0
@ -2320,7 +2367,7 @@ func TestPostInbox_Delete_CallsCallback(t *testing.T) {
PreparePostInboxTest(t, app, socialApp, fedApp, socialCb, fedCb, d, httpClient, p)
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("POST", testInboxURI, bytes.NewBuffer(MustSerialize(testDeleteNote))))
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
return testNote, nil
}
gotCallback := 0
@ -2540,7 +2587,10 @@ func TestPostInbox_Follow_AutoAccept(t *testing.T) {
}
gotGet := 0
var getIRI url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
getIRI = id
samActor := &vocab.Person{}
@ -2654,7 +2704,10 @@ func TestPostInbox_Follow_DoesNotAddForAutoAcceptIfAlreadyPresent(t *testing.T)
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
followers := &vocab.Collection{}
followers.AppendItemsIRI(*sallyIRI)
samActor := &vocab.Person{}
@ -2737,7 +2790,10 @@ func TestPostInbox_Follow_AutoAcceptFollowersIsOrderedCollection(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
samActor := &vocab.Person{}
samActor.SetInboxAnyURI(*samIRIInbox)
samActor.SetId(*samIRI)
@ -2816,7 +2872,10 @@ func TestPostInbox_Follow_AutoAcceptFollowersIsIRI(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
if id == *samIRI {
samActor := &vocab.Person{}
samActor.SetInboxAnyURI(*samIRIInbox)
@ -2951,7 +3010,10 @@ func TestPostInbox_Accept_AcceptFollowAddsToFollowersIfOwned(t *testing.T) {
}
gotGet := 0
var getIRI url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
getIRI = id
sallyActor := &vocab.Person{}
@ -3006,7 +3068,7 @@ func TestPostInbox_Accept_AcceptFollowDoesNotAddIfAlreadyInCollection(t *testing
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
following := &vocab.Collection{}
following.AppendItemsIRI(*samIRI)
sallyActor := &vocab.Person{}
@ -3053,7 +3115,10 @@ func TestPostInbox_Accept_AcceptFollowAddsToFollowersOrderedCollection(t *testin
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
sallyActor := &vocab.Person{}
sallyActor.SetInboxAnyURI(*sallyIRIInbox)
sallyActor.SetId(*sallyIRI)
@ -3096,7 +3161,10 @@ func TestPostInbox_Accept_AcceptFollowAddsToFollowersIRI(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
if id == *sallyIRI {
sallyActor := &vocab.Person{}
sallyActor.SetInboxAnyURI(*sallyIRIInbox)
@ -3168,7 +3236,7 @@ func TestPostInbox_Accept_CallsCallback(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
sallyActor := &vocab.Person{}
sallyActor.SetInboxAnyURI(*sallyIRIInbox)
sallyActor.SetId(*sallyIRI)
@ -3261,7 +3329,10 @@ func TestPostInbox_Add_AddIfTargetOwnedAndAppCanAdd(t *testing.T) {
}
gotGet := 0
var gotGetId url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
gotGetId = id
v := &vocab.Collection{}
@ -3330,7 +3401,7 @@ func TestPostInbox_Add_DoesNotAddIfAppCannotAdd(t *testing.T) {
}
gotGet := 0
var gotGetId url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
gotGet++
gotGetId = id
v := &vocab.Collection{}
@ -3378,7 +3449,7 @@ func TestPostInbox_Add_CallsCallback(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
v := &vocab.Collection{}
return v, nil
}
@ -3445,7 +3516,10 @@ func TestPostInbox_Remove_RemoveIfTargetOwnedAndCanRemove(t *testing.T) {
}
gotGet := 0
var gotGetId url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
gotGetId = id
v := &vocab.Collection{}
@ -3513,7 +3587,7 @@ func TestPostInbox_Remove_DoesNotRemoveIfAppCannotRemove(t *testing.T) {
}
gotGet := 0
var gotGetId url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
gotGet++
gotGetId = id
v := &vocab.Collection{}
@ -3564,7 +3638,7 @@ func TestPostInbox_Remove_CallsCallback(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
v := &vocab.Collection{}
return v, nil
}
@ -3604,7 +3678,10 @@ func TestPostInbox_Like_AddsToLikeCollection(t *testing.T) {
}
gotGet := 0
var gotGetId url.URL
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
gotGetId = id
v := &vocab.Note{}
@ -3661,7 +3738,7 @@ func TestPostInbox_Like_DoesNotAddLikeToCollectionIfAlreadyPresent(t *testing.T)
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
likes := &vocab.Collection{}
likes.AppendItemsIRI(*sallyIRI)
v := &vocab.Note{}
@ -3710,7 +3787,7 @@ func TestPostInbox_Like_AddsToLikeOrderedCollection(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
v := &vocab.Note{}
v.SetId(*noteIRI)
v.AppendNameString(noteName)
@ -3755,7 +3832,7 @@ func TestPostInbox_Like_AddsToLikeIRI(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if id == *noteIRI {
v := &vocab.Note{}
v.SetId(*noteIRI)
@ -3801,7 +3878,7 @@ func TestPostInbox_Like_CallsCallback(t *testing.T) {
app.owns = func(c context.Context, id url.URL) bool {
return true
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
v := &vocab.Note{}
v.SetId(*noteIRI)
v.AppendNameString(noteName)
@ -3856,7 +3933,7 @@ func TestGetInbox_RejectNonActivityPub(t *testing.T) {
app, _, _, _, _, _, _, p := NewPubberTest(t)
resp := httptest.NewRecorder()
req := httptest.NewRequest("GET", testInboxURI, nil)
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
return &vocab.OrderedCollection{}, nil
}
handled, err := p.GetInbox(context.Background(), resp, req)
@ -3871,7 +3948,7 @@ func TestGetInbox_SetsContentTypeHeader(t *testing.T) {
app, _, _, _, _, _, _, p := NewPubberTest(t)
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testInboxURI, nil))
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
return &vocab.OrderedCollection{}, nil
}
handled, err := p.GetInbox(context.Background(), resp, req)
@ -3890,7 +3967,7 @@ func TestGetInbox_DeduplicateInboxItems(t *testing.T) {
app, _, _, _, _, _, _, p := NewPubberTest(t)
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testInboxURI, nil))
app.getInbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getInbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
v := &vocab.OrderedCollection{}
v.AppendOrderedItemsObject(testCreateNote)
v.AppendOrderedItemsObject(testCreateNote)
@ -4443,7 +4520,7 @@ func TestPostOutbox_Update_DeleteSubFields(t *testing.T) {
return nil
}
gotGet := 0
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
gotGet++
if id != *noteIRI {
t.Fatalf("expected %s, got %s", noteIRI, id)
@ -4499,7 +4576,10 @@ func TestPostOutbox_Update_DeleteFields(t *testing.T) {
return nil
}
gotGet := 0
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
if id != *noteIRI {
t.Fatalf("expected %s, got %s", noteIRI, id)
@ -4551,7 +4631,7 @@ func TestPostOutbox_Update_DeleteSubFieldsMultipleObjects(t *testing.T) {
return nil
}
gotGet := 0
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
gotGet++
var v *vocab.Note
if id == *noteIRI {
@ -4629,7 +4709,7 @@ func TestPostOutbox_Update_OverwriteUpdatedFields(t *testing.T) {
return nil
}
gotGet := 0
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
gotGet++
if id != *noteIRI {
t.Fatalf("expected %s, got %s", noteIRI, id)
@ -4689,7 +4769,7 @@ func TestPostOutbox_Update_CallsCallback(t *testing.T) {
gotCallbackObject = s
return nil
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
samActor := &vocab.Person{}
samActor.SetInboxAnyURI(*samIRIInbox)
samActor.SetId(*samIRI)
@ -4750,7 +4830,7 @@ func TestPostOutbox_Update_IsDelivered(t *testing.T) {
}
return nil, nil
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
samActor := &vocab.Person{}
samActor.SetInboxAnyURI(*samIRIInbox)
samActor.SetId(*samIRI)
@ -4788,7 +4868,10 @@ func TestPostOutbox_Delete_SetsTombstone(t *testing.T) {
return nil
}
gotGet := 0
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
if id != *noteIRI {
t.Fatalf("expected %s, got %s", noteIRI, id)
@ -4841,7 +4924,7 @@ func TestPostOutbox_Delete_CallsCallback(t *testing.T) {
gotCallbackObject = s
return nil
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
return testNote, nil
}
app.set = func(c context.Context, p PubObject) error {
@ -4893,7 +4976,7 @@ func TestPostOutbox_Delete_IsDelivered(t *testing.T) {
}
return nil, nil
}
app.get = func(c context.Context, id url.URL) (PubObject, error) {
app.get = func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
return testNote, nil
}
app.set = func(c context.Context, p PubObject) error {
@ -5166,7 +5249,10 @@ func TestPostOutbox_Add_AddsIfTargetOwnedAndAppCanAdd(t *testing.T) {
}
gotGet := 0
var gotGetIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
gotGetIri = iri
col := &vocab.Collection{}
@ -5229,7 +5315,7 @@ func TestPostOutbox_Add_DoesNotAddIfAppCannotAdd(t *testing.T) {
}
gotGet := 0
var gotGetIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
gotGet++
gotGetIri = iri
col := &vocab.Collection{}
@ -5383,7 +5469,7 @@ func TestPostOutbox_Remove_RemoveIfTargetOwnedAndCanRemove(t *testing.T) {
}
gotGet := 0
var gotGetIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
gotGet++
gotGetIri = iri
col := &vocab.Collection{}
@ -5446,7 +5532,7 @@ func TestPostOutbox_Remove_DoesNotRemoveIfAppCannotRemove(t *testing.T) {
}
gotGet := 0
var gotGetIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
gotGet++
gotGetIri = iri
col := &vocab.Collection{}
@ -5579,7 +5665,10 @@ func TestPostOutbox_Like_AddsToLikedCollection(t *testing.T) {
}
gotGet := 0
var gotGetIri url.URL
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
if rw != ReadWrite {
t.Fatalf("expected RWType of %d, got %d", ReadWrite, rw)
}
gotGet++
gotGetIri = iri
v := &vocab.Person{}
@ -5634,7 +5723,7 @@ func TestPostOutbox_Like_DoesNotAddIfAlreadyLiked(t *testing.T) {
app.owns = func(c context.Context, iri url.URL) bool {
return true
}
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
liked := &vocab.Collection{}
liked.AppendItemsIRI(*noteIRI)
v := &vocab.Person{}
@ -5681,7 +5770,7 @@ func TestPostOutbox_Like_AddsToLikedOrderedCollection(t *testing.T) {
app.owns = func(c context.Context, iri url.URL) bool {
return true
}
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
v := &vocab.Person{}
v.AppendNameString("Sally")
v.SetId(*sallyIRI)
@ -5751,7 +5840,7 @@ func TestPostOutbox_Like_CallsCallback(t *testing.T) {
app.owns = func(c context.Context, iri url.URL) bool {
return true
}
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
v := &vocab.Person{}
v.AppendNameString("Sally")
v.SetId(*sallyIRI)
@ -5788,7 +5877,7 @@ func TestPostOutbox_Like_IsDelivered(t *testing.T) {
app.owns = func(c context.Context, iri url.URL) bool {
return true
}
app.get = func(c context.Context, iri url.URL) (PubObject, error) {
app.get = func(c context.Context, iri url.URL, rw RWType) (PubObject, error) {
v := &vocab.Person{}
v.AppendNameString("Sally")
v.SetId(*sallyIRI)
@ -5983,7 +6072,7 @@ func TestGetOutbox_RejectNonActivityPub(t *testing.T) {
app, _, _, _, _, _, _, p := NewPubberTest(t)
resp := httptest.NewRecorder()
req := httptest.NewRequest("GET", testOutboxURI, nil)
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
return &vocab.OrderedCollection{}, nil
}
handled, err := p.GetOutbox(context.Background(), resp, req)
@ -5998,7 +6087,7 @@ func TestGetOutbox_SetsContentTypeHeader(t *testing.T) {
app, _, _, _, _, _, _, p := NewPubberTest(t)
resp := httptest.NewRecorder()
req := ActivityPubRequest(httptest.NewRequest("GET", testOutboxURI, nil))
app.getOutbox = func(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error) {
app.getOutbox = func(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error) {
return &vocab.OrderedCollection{}, nil
}
handled, err := p.GetOutbox(context.Background(), resp, req)

ファイルの表示

@ -93,9 +93,9 @@ func serveActivityPubObject(c context.Context, a Application, clock Clock, w htt
}
var pObj PubObject
if verifiedUser != nil {
pObj, err = a.GetAsVerifiedUser(c, *r.URL, *verifiedUser)
pObj, err = a.GetAsVerifiedUser(c, *r.URL, *verifiedUser, Read)
} else {
pObj, err = a.Get(c, *r.URL)
pObj, err = a.Get(c, *r.URL, Read)
}
if err != nil {
return

ファイルの表示

@ -25,8 +25,10 @@ func TestServeActivityPubObject(t *testing.T) {
name: "unsigned request",
app: &MockApplication{
t: t,
get: func(c context.Context, id url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
get: func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
}
testNote = &vocab.Note{}
@ -65,8 +67,10 @@ func TestServeActivityPubObject(t *testing.T) {
}
return testPrivateKey.Public(), httpsig.RSA_SHA256, *samIRI, nil
},
getAsVerifiedUser: func(c context.Context, id, user url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
getAsVerifiedUser: func(c context.Context, id, user url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
} else if u := (&user).String(); u != samIRIString {
t.Fatalf("(%q) expected %s, got %s", samIRIString, u)
@ -172,8 +176,10 @@ func TestServeActivityPubObjectWithVerificationMethod(t *testing.T) {
name: "unsigned request",
app: &MockApplication{
t: t,
get: func(c context.Context, id url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
get: func(c context.Context, id url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
}
testNote = &vocab.Note{}
@ -212,8 +218,10 @@ func TestServeActivityPubObjectWithVerificationMethod(t *testing.T) {
}
return testPrivateKey.Public(), httpsig.RSA_SHA256, *samIRI, nil
},
getAsVerifiedUser: func(c context.Context, id, user url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
getAsVerifiedUser: func(c context.Context, id, user url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
} else if u := (&user).String(); u != samIRIString {
t.Fatalf("(%q) expected %s, got %s", samIRIString, u)
@ -287,8 +295,10 @@ func TestServeActivityPubObjectWithVerificationMethod(t *testing.T) {
name: "unsigned request passes verifier",
app: &MockApplication{
t: t,
getAsVerifiedUser: func(c context.Context, id, user url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
getAsVerifiedUser: func(c context.Context, id, user url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
} else if u := (&user).String(); u != samIRIString {
t.Fatalf("(%q) expected %s, got %s", samIRIString, u)
@ -329,8 +339,10 @@ func TestServeActivityPubObjectWithVerificationMethod(t *testing.T) {
input: Sign(ActivityPubRequest(httptest.NewRequest("GET", noteURIString, nil))),
app: &MockApplication{
t: t,
getAsVerifiedUser: func(c context.Context, id, user url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
getAsVerifiedUser: func(c context.Context, id, user url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
} else if u := (&user).String(); u != samIRIString {
t.Fatalf("(%q) expected %s, got %s", samIRIString, u)
@ -442,8 +454,10 @@ func TestServeActivityPubObjectWithVerificationMethod(t *testing.T) {
}
return testPrivateKey.Public(), httpsig.RSA_SHA256, *samIRI, nil
},
getAsVerifiedUser: func(c context.Context, id, user url.URL) (PubObject, error) {
if s := (&id).String(); s != noteURIString {
getAsVerifiedUser: func(c context.Context, id, user url.URL, rw RWType) (PubObject, error) {
if rw != Read {
t.Fatalf("expected RWType of %d, got %d", Read, rw)
} else if s := (&id).String(); s != noteURIString {
t.Fatalf("(%q) expected %s, got %s", noteURIString, s)
} else if u := (&user).String(); u != samIRIString {
t.Fatalf("(%q) expected %s, got %s", samIRIString, u)

ファイルの表示

@ -78,11 +78,11 @@ type Application interface {
// Owns returns true if the provided id is owned by this server.
Owns(c context.Context, id url.URL) bool
// Get fetches the ActivityStream representation of the given id.
Get(c context.Context, id url.URL) (PubObject, error)
Get(c context.Context, id url.URL, rw RWType) (PubObject, error)
// GetAsVerifiedUser fetches the ActivityStream representation of the
// given id with the provided IRI representing the authenticated user
// making the request.
GetAsVerifiedUser(c context.Context, id, authdUser url.URL) (PubObject, error)
GetAsVerifiedUser(c context.Context, id, authdUser url.URL, rw RWType) (PubObject, error)
// Has determines if the server already knows about the object or
// Activity specified by the given id.
Has(c context.Context, id url.URL) (bool, error)
@ -92,11 +92,11 @@ type Application interface {
// GetInbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
GetInbox(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error)
GetInbox(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error)
// GetOutbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
GetOutbox(c context.Context, r *http.Request) (vocab.OrderedCollectionType, error)
GetOutbox(c context.Context, r *http.Request, rw RWType) (vocab.OrderedCollectionType, error)
// NewId takes in a client id token and returns an ActivityStreams IRI
// id for a new Activity posted to the outbox. The object is provided
// as a Typer so clients can use it to decide how to generate the IRI.
@ -107,6 +107,16 @@ type Application interface {
GetPublicKey(c context.Context, publicKeyId string) (pubKey crypto.PublicKey, algo httpsig.Algorithm, user url.URL, err error)
}
// RWType indicates the kind of reading being done.
type RWType int
const (
// Read indicates the object is only being read.
Read RWType = iota
// ReadWrite indicates the object is being mutated as well.
ReadWrite
)
// SocialApp is provided by users of this library and designed to handle
// receiving messages from ActivityPub clients through the Social API.
type SocialApp interface {

ファイルの表示

@ -1289,7 +1289,7 @@ func (f *federator) addAllObjectsToActorCollection(ctx context.Context, getter g
continue
}
var actor vocab.ObjectType
pObj, err := f.App.Get(ctx, iri)
pObj, err := f.App.Get(ctx, iri, ReadWrite)
if err != nil {
return err
}
@ -1395,7 +1395,7 @@ func (f *federator) addAllActorsToObjectCollection(ctx context.Context, getter g
}
ownsAny = true
var object vocab.ObjectType
pObj, err := f.App.Get(ctx, iri)
pObj, err := f.App.Get(ctx, iri, ReadWrite)
if err != nil {
return ownsAny, err
}
@ -1520,7 +1520,7 @@ func (f *federator) ownsAnyObjects(c context.Context, a vocab.ActivityType) (boo
}
func (f *federator) addToOutbox(c context.Context, r *http.Request, m map[string]interface{}) error {
outbox, err := f.App.GetOutbox(c, r)
outbox, err := f.App.GetOutbox(c, r, ReadWrite)
if err != nil {
return err
}
@ -1533,7 +1533,7 @@ func (f *federator) addToOutbox(c context.Context, r *http.Request, m map[string
}
func (f *federator) addToInbox(c context.Context, r *http.Request, m map[string]interface{}) error {
inbox, err := f.App.GetInbox(c, r)
inbox, err := f.App.GetInbox(c, r, ReadWrite)
if err != nil {
return err
}
@ -1588,7 +1588,7 @@ func (f *federator) inboxForwarding(c context.Context, m map[string]interface{})
} else if !ok {
continue
}
obj, err := f.App.Get(c, iri)
obj, err := f.App.Get(c, iri, Read)
if err != nil {
return err
}