teams: viewers and editors can view teams

This commit is contained in:
Hugo Häggmark
2019-03-13 10:38:09 +01:00
committed by Leonard Gram
parent c420af16b1
commit 782b5b6a3a
5 changed files with 15 additions and 22 deletions

View File

@ -87,18 +87,13 @@ func Auth(options *AuthOptions) macaron.Handler {
}
}
func EditorCanAdmin(enabled bool) macaron.Handler {
func AdminOrCanAdmin(enabled bool) macaron.Handler {
return func(c *m.ReqContext) {
ok := false
if c.OrgRole == m.ROLE_ADMIN {
ok = true
return
}
if c.OrgRole == m.ROLE_EDITOR && enabled {
ok = true
}
if !ok {
if !enabled {
accessForbidden(c)
}
}