Skip to content

Commit

Permalink
Merge branch 'main' of github.com:veops/oneterm
Browse files Browse the repository at this point in the history
  • Loading branch information
fxiang21 committed Feb 2, 2024
2 parents 029023a + cf84110 commit 357880d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/pkg/proto/ssh/api/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@ func (a *AssetCore) HasPermission(data *model.AccessAuth) bool {
return false
}
in = false
has := false
week, hm := now.Weekday(), now.Format("15:04")
for _, r := range data.Ranges {
has = has || len(r.Times) > 0
if (r.Week+1)%7 == int(week) {
for _, str := range r.Times {
ss := strings.Split(str, "~")
in = in || (len(ss) >= 2 && hm >= ss[0] && hm <= ss[1])
}
}
}
return in == data.Allow
return !has || in == data.Allow
}

func (a *AssetCore) Gateway(cookie string, id int) (res *model.Gateway, err error) {
Expand Down

0 comments on commit 357880d

Please sign in to comment.