1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-08 01:18:14 +00:00

Add /about page, remove -title option, add -name and -icon options

This commit is contained in:
bouncepaw
2021-01-23 18:45:17 +05:00
parent 355fd4b1b0
commit e72ca863e3
8 changed files with 237 additions and 75 deletions

View File

@@ -8,6 +8,28 @@ var AuthUsed bool
var users sync.Map
var tokens sync.Map
func ListUsersWithGroup(group string) []string {
usersWithTheGroup := []string{}
users.Range(func(_, v interface{}) bool {
userobj := v.(*User)
if userobj.Group == group {
usersWithTheGroup = append(usersWithTheGroup, userobj.Name)
}
return true
})
return usersWithTheGroup
}
func Count() int {
i := 0
users.Range(func(k, v interface{}) bool {
i++
return true
})
return i
}
func HasUsername(username string) bool {
_, has := users.Load(username)
return has