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:
parent
1c4a4424e5
commit
359e0e29eb
7 changed files with 236 additions and 142 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue