Show logs to org admin

This commit is contained in:
Gucheng Wang
2022-09-18 16:16:45 +08:00
parent 6670450439
commit 084a5c3e6b
5 changed files with 37 additions and 14 deletions

View File

@ -90,6 +90,19 @@ func (c *ApiController) RequireSignedInUser() (*object.User, bool) {
return user, true
}
// RequireAdmin ...
func (c *ApiController) RequireAdmin() (string, bool) {
user, ok := c.RequireSignedInUser()
if !ok {
return "", false
}
if user.Owner == "built-in" {
return "", true
}
return user.Owner, true
}
func getInitScore() (int, error) {
return strconv.Atoi(conf.GetConfigString("initScore"))
}