mirror of
https://github.com/documize/community.git
synced 2025-07-22 22:59:43 +02:00
space categorty management
This commit is contained in:
parent
a86d52388e
commit
4874d23f15
19 changed files with 915 additions and 40 deletions
|
@ -134,3 +134,24 @@ func (s Scope) DeleteUserPermissions(ctx domain.RequestContext, userID string) (
|
|||
|
||||
return b.DeleteWhere(ctx.Transaction, sql)
|
||||
}
|
||||
|
||||
// DeleteCategoryPermissions removes records from permissions table for given category ID.
|
||||
func (s Scope) DeleteCategoryPermissions(ctx domain.RequestContext, categoryID string) (rows int64, err error) {
|
||||
b := mysql.BaseQuery{}
|
||||
|
||||
sql := fmt.Sprintf("DELETE FROM permission WHERE orgid='%s' AND location='category' AND refid='%s'", ctx.OrgID, categoryID)
|
||||
|
||||
return b.DeleteWhere(ctx.Transaction, sql)
|
||||
}
|
||||
|
||||
// DeleteSpaceCategoryPermissions removes all category permission for for given space.
|
||||
func (s Scope) DeleteSpaceCategoryPermissions(ctx domain.RequestContext, spaceID string) (rows int64, err error) {
|
||||
b := mysql.BaseQuery{}
|
||||
|
||||
sql := fmt.Sprintf(`
|
||||
DELETE FROM permission WHERE orgid='%s' AND location='category'
|
||||
AND refid IN (SELECT refid FROM category WHERE orgid='%s' AND labelid='%s')`,
|
||||
ctx.OrgID, ctx.OrgID, spaceID)
|
||||
|
||||
return b.DeleteWhere(ctx.Transaction, sql)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue