diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/context.go | 11 | ||||
-rw-r--r-- | web/params.go | 8 | ||||
-rw-r--r-- | web/web_test.go | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/web/context.go b/web/context.go index 711d241ae..8f79421e5 100644 --- a/web/context.go +++ b/web/context.go @@ -490,6 +490,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 e97b206ab..2c30ba4c0 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 { diff --git a/web/web_test.go b/web/web_test.go index 9b6230013..b53ed9618 100644 --- a/web/web_test.go +++ b/web/web_test.go @@ -61,6 +61,7 @@ func Setup() *TestHelper { ApiClient = model.NewAPIv4Client(URL) a.DoAdvancedPermissionsMigration() + a.DoEmojisPermissionsMigration() a.Srv.Store.MarkSystemRanUnitTests() |