Publish UserFeatureChanged event when users update their password

This commit is contained in:
Ralf Haferkamp
2022-05-09 11:31:09 +02:00
committed by Ralf Haferkamp
parent c41cf92553
commit 112488607e
2 changed files with 11 additions and 0 deletions
@@ -9,6 +9,7 @@ import (
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
revactx "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/cs3org/reva/v2/pkg/events"
"github.com/go-chi/render"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/extensions/graph/pkg/service/v0/errorcode"
@@ -83,6 +84,15 @@ func (g Graph) ChangeOwnPassword(w http.ResponseWriter, r *http.Request) {
return
}
g.publishEvent(
events.UserFeatureChanged{
UserID: u.Id.OpaqueId,
Features: []events.UserFeature{
events.UserFeature{Name: "password", Value: "***"},
},
},
)
render.Status(r, http.StatusNoContent)
render.NoContent(w, r)
}
@@ -85,6 +85,7 @@ var _ = Describe("Users changing their own password", func() {
},
}
ctx = revactx.ContextSetUser(ctx, user)
eventsPublisher.On("Publish", mock.Anything, mock.Anything, mock.Anything).Return(nil)
})
It("fails if no user in context", func() {