diff options
Diffstat (limited to 'model/client.go')
-rw-r--r-- | model/client.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go index e2e003fe8..f43e5ad79 100644 --- a/model/client.go +++ b/model/client.go @@ -887,6 +887,19 @@ func (c *Client) TestEmail(config *Config) (*Result, *AppError) { } } +// TestLdap will run a connection test on the current LDAP settings. +// It will return the standard OK response if settings work. Otherwise +// it will return an appropriate error. +func (c *Client) TestLdap(config *Config) (*Result, *AppError) { + if r, err := c.DoApiPost("/admin/ldap_test", config.ToJson()); err != nil { + return nil, err + } else { + defer closeBody(r) + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil + } +} + func (c *Client) GetComplianceReports() (*Result, *AppError) { if r, err := c.DoApiGet("/admin/compliance_reports", "", ""); err != nil { return nil, err |