added user independent sections and started db migration work

This commit is contained in:
ston1th 2019-03-26 23:55:55 +01:00
commit 16ea95bf09
24 changed files with 622 additions and 122 deletions

26
pkg/db/permission.go Normal file
View file

@ -0,0 +1,26 @@
// Copyright (C) 2019 Marius Schellenberger
package db
import (
"git.giftfish.de/ston1th/gowiki/pkg/core"
"git.giftfish.de/ston1th/gowiki/pkg/render"
)
func (db *DB) ReadPerm(st, username string, p core.Permission) bool {
section, _ := render.SplitStoreTitle(st)
s, err := db.GetSection(section)
if err != nil {
return false
}
return core.ReadPerm(username, p, s)
}
func (db *DB) WritePerm(st, username string, p core.Permission) bool {
section, _ := render.SplitStoreTitle(st)
s, err := db.GetSection(section)
if err != nil {
return false
}
return core.WritePerm(username, p, s)
}