[MM-32281] SqlRoleStore/GetByName: add context to allow read from master (#17176)

* role_store/GetByName: add context

* propagate context in the app layer

* propagate context in the app layer

* add missing import

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2021-04-21 18:01:02 +03:00
коммит произвёл GitHub
родитель 9eceeaa8db
Коммит 28ff4dc8d0
37 изменённых файлов: 225 добавлений и 198 удалений

Просмотреть файл

@@ -5,6 +5,7 @@ package web
import (
"bytes"
"context"
"encoding/base64"
"io"
"io/ioutil"
@@ -677,7 +678,7 @@ func (th *TestHelper) SaveDefaultRolePermissions() map[string][]string {
"channel_user",
"channel_admin",
} {
role, err1 := th.App.GetRoleByName(roleName)
role, err1 := th.App.GetRoleByName(context.Background(), roleName)
if err1 != nil {
utils.EnableDebugLogForTest()
panic(err1)
@@ -694,7 +695,7 @@ func (th *TestHelper) RestoreDefaultRolePermissions(data map[string][]string) {
utils.DisableDebugLogForTest()
for roleName, permissions := range data {
role, err1 := th.App.GetRoleByName(roleName)
role, err1 := th.App.GetRoleByName(context.Background(), roleName)
if err1 != nil {
utils.EnableDebugLogForTest()
panic(err1)
@@ -751,7 +752,7 @@ func (th *TestHelper) RestoreDefaultRolePermissions(data map[string][]string) {
func (th *TestHelper) AddPermissionToRole(permission string, roleName string) {
utils.DisableDebugLogForTest()
role, err1 := th.App.GetRoleByName(roleName)
role, err1 := th.App.GetRoleByName(context.Background(), roleName)
if err1 != nil {
utils.EnableDebugLogForTest()
panic(err1)