teams: editors can work with teams.

This commit is contained in:
Leonard Gram
2019-03-19 13:57:22 +01:00
parent efbd93f824
commit 22e098b830
3 changed files with 22 additions and 4 deletions
+17
View File
@@ -86,3 +86,20 @@ func Auth(options *AuthOptions) macaron.Handler {
}
}
}
func EditorCanAdmin(enabled bool) macaron.Handler {
return func(c *m.ReqContext) {
ok := false
if c.OrgRole == m.ROLE_ADMIN {
ok = true
}
if c.OrgRole == m.ROLE_EDITOR && enabled {
ok = true
}
if !ok {
accessForbidden(c)
}
}
}