[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 удалений

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

@@ -4,6 +4,7 @@
package app
import (
"context"
"errors"
"net/http"
"reflect"
@@ -38,8 +39,8 @@ func (a *App) GetAllRoles() ([]*model.Role, *model.AppError) {
return roles, nil
}
func (s *Server) GetRoleByName(name string) (*model.Role, *model.AppError) {
role, nErr := s.Store.Role().GetByName(name)
func (s *Server) GetRoleByName(ctx context.Context, name string) (*model.Role, *model.AppError) {
role, nErr := s.Store.Role().GetByName(ctx, name)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -58,8 +59,8 @@ func (s *Server) GetRoleByName(name string) (*model.Role, *model.AppError) {
return role, nil
}
func (a *App) GetRoleByName(name string) (*model.Role, *model.AppError) {
return a.Srv().GetRoleByName(name)
func (a *App) GetRoleByName(ctx context.Context, name string) (*model.Role, *model.AppError) {
return a.Srv().GetRoleByName(ctx, name)
}
func (a *App) GetRolesByNames(names []string) ([]*model.Role, *model.AppError) {