aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/helpers/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'roomserver/internal/helpers/auth.go')
-rw-r--r--roomserver/internal/helpers/auth.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/roomserver/internal/helpers/auth.go b/roomserver/internal/helpers/auth.go
index 7782d07d..89fae244 100644
--- a/roomserver/internal/helpers/auth.go
+++ b/roomserver/internal/helpers/auth.go
@@ -22,6 +22,7 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
+ "github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/roomserver/state"
"github.com/matrix-org/dendrite/roomserver/storage"
"github.com/matrix-org/dendrite/roomserver/types"
@@ -36,6 +37,7 @@ func CheckForSoftFail(
roomInfo *types.RoomInfo,
event *types.HeaderedEvent,
stateEventIDs []string,
+ querier api.QuerySenderIDAPI,
) (bool, error) {
rewritesState := len(stateEventIDs) > 1
@@ -49,7 +51,7 @@ func CheckForSoftFail(
} else {
// Then get the state entries for the current state snapshot.
// We'll use this to check if the event is allowed right now.
- roomState := state.NewStateResolution(db, roomInfo)
+ roomState := state.NewStateResolution(db, roomInfo, querier)
authStateEntries, err = roomState.LoadStateAtSnapshot(ctx, roomInfo.StateSnapshotNID())
if err != nil {
return true, fmt.Errorf("roomState.LoadStateAtSnapshot: %w", err)
@@ -76,8 +78,8 @@ func CheckForSoftFail(
}
// Check if the event is allowed.
- if err = gomatrixserverlib.Allowed(event.PDU, &authEvents, func(roomID string, senderID spec.SenderID) (*spec.UserID, error) {
- return db.GetUserIDForSender(ctx, roomID, senderID)
+ if err = gomatrixserverlib.Allowed(event.PDU, &authEvents, func(roomID spec.RoomID, senderID spec.SenderID) (*spec.UserID, error) {
+ return querier.QueryUserIDForSender(ctx, roomID, senderID)
}); err != nil {
// return true, nil
return true, err