Fix bots being unable to post when personal access tokens are disabled. (#11105)

Этот коммит содержится в:
Christopher Speller
2019-06-13 11:54:09 -07:00
коммит произвёл GitHub
родитель 729a7ac0ac
Коммит 1ca421472f
5 изменённых файлов: 40 добавлений и 5 удалений

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

@@ -86,7 +86,10 @@ func (c *Context) IsSystemAdmin() bool {
}
func (c *Context) SessionRequired() {
if !*c.App.Config().ServiceSettings.EnableUserAccessTokens && c.App.Session.Props[model.SESSION_PROP_TYPE] == model.SESSION_TYPE_USER_ACCESS_TOKEN {
if !*c.App.Config().ServiceSettings.EnableUserAccessTokens &&
c.App.Session.Props[model.SESSION_PROP_TYPE] == model.SESSION_TYPE_USER_ACCESS_TOKEN &&
c.App.Session.Props[model.SESSION_PROP_IS_BOT] != model.SESSION_PROP_IS_BOT_VALUE {
c.Err = model.NewAppError("", "api.context.session_expired.app_error", nil, "UserAccessToken", http.StatusUnauthorized)
return
}