diff options
Diffstat (limited to 'app/plugin_api.go')
-rw-r--r-- | app/plugin_api.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/plugin_api.go b/app/plugin_api.go index 503feabee..20a27316f 100644 --- a/app/plugin_api.go +++ b/app/plugin_api.go @@ -184,6 +184,22 @@ func (api *PluginAPI) UpdateUserStatus(userId, status string) (*model.Status, *m return api.app.GetStatus(userId) } +func (api *PluginAPI) GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError) { + if api.app.Ldap == nil { + return nil, model.NewAppError("GetLdapUserAttributes", "ent.ldap.disabled.app_error", nil, "", http.StatusNotImplemented) + } + + user, err := api.app.GetUser(userId) + if err != nil { + return nil, err + } + + if user.AuthService != model.USER_AUTH_SERVICE_LDAP || user.AuthData == nil { + return map[string]string{}, nil + } + + return api.app.Ldap.GetUserAttributes(*user.AuthData, attributes) +} func (api *PluginAPI) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { return api.app.CreateChannel(channel, false) |