feat: user roles (#852)

* [WIP] feat: user roles

* update

* update

* admin handler

* update

* feat: user-specific connection secret

* simplify some logics

* cleanup

* update waf

* update user api error handling

* update waf api

* fix codeql

* update waf table

* fix several problems

* add pagination for waf api

* update permission checks

* switch to runtime check

* 1

* cover?

* some changes
This commit is contained in:
UUBulb
2024-12-22 00:05:41 +08:00
committed by GitHub
parent 50ee62172f
commit 653d0cf2e9
35 changed files with 841 additions and 180 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/robfig/cron/v3"
"github.com/nezhahq/nezha/model"
"github.com/nezhahq/nezha/pkg/utils"
pb "github.com/nezhahq/nezha/proto"
)
@@ -79,10 +80,7 @@ func UpdateCronList() {
CronLock.RLock()
defer CronLock.RUnlock()
CronList = make([]*model.Cron, 0, len(Crons))
for _, c := range Crons {
CronList = append(CronList, c)
}
CronList = utils.MapValuesToSlice(Crons)
slices.SortFunc(CronList, func(a, b *model.Cron) int {
return cmp.Compare(a.ID, b.ID)
})