diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/context.go | 11 | ||||
-rw-r--r-- | web/params.go | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/web/context.go b/web/context.go index bf7cfcb8d..b1ab8a4a8 100644 --- a/web/context.go +++ b/web/context.go @@ -486,6 +486,17 @@ func (c *Context) RequireRoleId() *Context { return c } +func (c *Context) RequireSchemeId() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.SchemeId) != 26 { + c.SetInvalidUrlParam("scheme_id") + } + return c +} + func (c *Context) RequireRoleName() *Context { if c.Err != nil { return c diff --git a/web/params.go b/web/params.go index 286c3f44f..cca306844 100644 --- a/web/params.go +++ b/web/params.go @@ -47,6 +47,8 @@ type Params struct { ActionId string RoleId string RoleName string + SchemeId string + Scope string Page int PerPage int LogsPerPage int @@ -167,6 +169,12 @@ func ParamsFromRequest(r *http.Request) *Params { params.RoleName = val } + if val, ok := props["scheme_id"]; ok { + params.SchemeId = val + } + + params.Scope = query.Get("scope") + if val, err := strconv.Atoi(query.Get("page")); err != nil || val < 0 { params.Page = PAGE_DEFAULT } else { |