1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +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

@ -289,3 +289,13 @@ func (s Scope) DeleteSpaceCategoryPermissions(ctx domain.RequestContext, spaceID
return b.DeleteWhere(ctx.Transaction, sql)
}
// DeleteGroupPermissions removes all roles for the specified group
func (s Scope) DeleteGroupPermissions(ctx domain.RequestContext, groupID string) (rows int64, err error) {
b := mysql.BaseQuery{}
sql := fmt.Sprintf("DELETE FROM permission WHERE orgid='%s' AND who='role' AND whoid='%s'",
ctx.OrgID, groupID)
return b.DeleteWhere(ctx.Transaction, sql)
}