diff options
author | Kegsay <kegan@matrix.org> | 2020-09-04 10:40:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 10:40:58 +0100 |
commit | 2570418f4297a6183231e2a7cda494f55bab4dda (patch) | |
tree | 01a448a856545a4e628f276214223f07b46869a1 /roomserver | |
parent | f1a98e11931817ff74b87e0a25ab79c7e12a8ea8 (diff) |
Remove ServerACLs from the current state server (#1390)
* Remove ServerACLs from the current state server
Functionality moved to roomserver
* Nothing to see here, move along
Diffstat (limited to 'roomserver')
-rw-r--r-- | roomserver/internal/api.go | 4 | ||||
-rw-r--r-- | roomserver/internal/input/input.go | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/roomserver/internal/api.go b/roomserver/internal/api.go index bdea650e..4299dd47 100644 --- a/roomserver/internal/api.go +++ b/roomserver/internal/api.go @@ -40,6 +40,7 @@ func NewRoomserverAPI( outputRoomEventTopic string, caches caching.RoomServerCaches, keyRing gomatrixserverlib.JSONVerifier, ) *RoomserverInternalAPI { + serverACLs := acls.NewServerACLs(roomserverDB) a := &RoomserverInternalAPI{ DB: roomserverDB, Cfg: cfg, @@ -49,13 +50,14 @@ func NewRoomserverAPI( Queryer: &query.Queryer{ DB: roomserverDB, Cache: caches, - ServerACLs: acls.NewServerACLs(roomserverDB), + ServerACLs: serverACLs, }, Inputer: &input.Inputer{ DB: roomserverDB, OutputRoomEventTopic: outputRoomEventTopic, Producer: producer, ServerName: cfg.Matrix.ServerName, + ACLs: serverACLs, }, // perform-er structs get initialised when we have a federation sender to use } diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index 7a44ff42..51d20ad3 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -22,6 +22,7 @@ import ( "time" "github.com/Shopify/sarama" + "github.com/matrix-org/dendrite/roomserver/acls" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/dendrite/roomserver/storage" "github.com/matrix-org/gomatrixserverlib" @@ -33,6 +34,7 @@ type Inputer struct { DB storage.Database Producer sarama.SyncProducer ServerName gomatrixserverlib.ServerName + ACLs *acls.ServerACLs OutputRoomEventTopic string workers sync.Map // room ID -> *inputWorker @@ -88,6 +90,10 @@ func (r *Inputer) WriteOutputEvents(roomID string, updates []api.OutputEvent) er "send_as_server": updates[i].NewRoomEvent.SendAsServer, "sender": updates[i].NewRoomEvent.Event.Sender(), }) + if updates[i].NewRoomEvent.Event.Type() == "m.room.server_acl" && updates[i].NewRoomEvent.Event.StateKeyEquals("") { + ev := updates[i].NewRoomEvent.Event.Unwrap() + defer r.ACLs.OnServerACLUpdate(&ev) + } } logger.Infof("Producing to topic '%s'", r.OutputRoomEventTopic) messages[i] = &sarama.ProducerMessage{ |