MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)

* Generate and use an interface instead of *App
Этот коммит содержится в:
Eli Yukelzon
2020-02-13 13:26:58 +01:00
коммит произвёл GitHub
родитель 66fc096768
Коммит 17523fa5d9
200 изменённых файлов: 4553 добавлений и 2361 удалений

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

@@ -30,7 +30,7 @@ func NewPluginAPI(a *App, manifest *model.Manifest) *PluginAPI {
id: manifest.Id,
manifest: manifest,
app: a,
logger: a.Log.With(mlog.String("plugin_id", manifest.Id)).Sugar(),
logger: a.Log().With(mlog.String("plugin_id", manifest.Id)).Sugar(),
}
}
@@ -292,7 +292,7 @@ func (api *PluginAPI) GetUsersInChannel(channelId, sortBy string, page, perPage
}
func (api *PluginAPI) GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError) {
if api.app.Ldap == nil {
if api.app.Ldap() == nil {
return nil, model.NewAppError("GetLdapUserAttributes", "ent.ldap.disabled.app_error", nil, "", http.StatusNotImplemented)
}
@@ -308,7 +308,7 @@ func (api *PluginAPI) GetLDAPUserAttributes(userId string, attributes []string)
// Only bother running the query if the user's auth service is LDAP or it's SAML and sync is enabled.
if user.AuthService == model.USER_AUTH_SERVICE_LDAP ||
(user.AuthService == model.USER_AUTH_SERVICE_SAML && *api.app.Config().SamlSettings.EnableSyncWithLdap) {
return api.app.Ldap.GetUserAttributes(*user.AuthData, attributes)
return api.app.Ldap().GetUserAttributes(*user.AuthData, attributes)
}
return map[string]string{}, nil