first working version
This commit is contained in:
parent
14e0611f06
commit
85f93bae69
32 changed files with 863 additions and 571 deletions
|
|
@ -21,6 +21,18 @@ func ParsePerm(p int) Permission {
|
|||
return Invalid
|
||||
}
|
||||
|
||||
func ParsePermString(p string) Permission {
|
||||
switch p {
|
||||
case "1":
|
||||
return Public
|
||||
case "2":
|
||||
return Internal
|
||||
case "3":
|
||||
return Private
|
||||
}
|
||||
return Invalid
|
||||
}
|
||||
|
||||
func ReadPerm(username string, p *Page) bool {
|
||||
switch p.Perm {
|
||||
case Public:
|
||||
|
|
@ -33,7 +45,14 @@ func ReadPerm(username string, p *Page) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func WritePerm(username string, p *Page) bool {
|
||||
func WritePerm(username, section string, p *Page) bool {
|
||||
if section != WikiSection && section != username {
|
||||
return false
|
||||
}
|
||||
return writePerm(username, p)
|
||||
}
|
||||
|
||||
func writePerm(username string, p *Page) bool {
|
||||
switch p.Perm {
|
||||
case Public, Internal:
|
||||
if p.Owner == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue