PLT-3629 fix uploading certificates if the files in the config do not exists (#3634)

Этот коммит содержится в:
enahum
2016-07-20 17:01:10 -04:00
коммит произвёл Corey Hulen
родитель b0090214ef
Коммит 86d496c9b7
5 изменённых файлов: 71 добавлений и 1 удалений

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

@@ -1730,7 +1730,7 @@ func (c *Client) UploadCertificateFile(data []byte, contentType string) *AppErro
}
// Removes a x509 base64 Certificate or Private Key file used with SAML.
// filename is required. Returns nil if succesful, otherwise returns an AppError
// filename is required. Returns nil if successful, otherwise returns an AppError
func (c *Client) RemoveCertificateFile(filename string) *AppError {
if r, err := c.DoApiPost("/admin/remove_certificate", MapToJson(map[string]string{"filename": filename})); err != nil {
return err
@@ -1739,3 +1739,14 @@ func (c *Client) RemoveCertificateFile(filename string) *AppError {
return nil
}
}
// Checks if the x509 base64 Certificates and Private Key files used with SAML exists on the file system.
// Returns a map[string]interface{} if successful, otherwise returns an AppError. Must be System Admin authenticated.
func (c *Client) SamlCertificateStatus(filename string) (map[string]interface{}, *AppError) {
if r, err := c.DoApiGet("/admin/remove_certificate", "", ""); err != nil {
return nil, err
} else {
defer closeBody(r)
return StringInterfaceFromJson(r.Body), nil
}
}