[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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9eceeaa8db
Коммит
28ff4dc8d0
@@ -5,6 +5,7 @@ package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -461,7 +462,7 @@ func (th *TestHelper) CreateScheme() (*model.Scheme, []*model.Role) {
|
||||
|
||||
var roles []*model.Role
|
||||
for _, roleName := range roleNames {
|
||||
role, err := th.App.GetRoleByName(roleName)
|
||||
role, err := th.App.GetRoleByName(context.Background(), roleName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -652,7 +653,7 @@ func (th *TestHelper) SetupPluginAPI() *PluginAPI {
|
||||
func (th *TestHelper) RemovePermissionFromRole(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)
|
||||
@@ -684,7 +685,7 @@ func (th *TestHelper) RemovePermissionFromRole(permission string, roleName strin
|
||||
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)
|
||||
|
||||
Ссылка в новой задаче
Block a user