1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 16:19:46 +02:00

Remove group permissions on delete event

This commit is contained in:
Harvey Kandola 2018-03-09 09:51:44 +00:00
parent 1c4a4424e5
commit 359e0e29eb
7 changed files with 236 additions and 142 deletions

View file

@ -202,6 +202,7 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
return
}
// Delete group and associated membership data
_, err = h.Store.Group.Delete(ctx, g.RefID)
if err != nil {
ctx.Transaction.Rollback()
@ -210,6 +211,15 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
return
}
// Delete permissions associated with group
_, err = h.Store.Permission.DeleteGroupPermissions(ctx, groupID)
if err != nil {
ctx.Transaction.Rollback()
response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err)
return
}
ctx.Transaction.Commit()
h.Store.Audit.Record(ctx, audit.EventTypeGroupDelete)