Этот коммит содержится в:
Jesús Espino
2018-06-19 19:40:26 +02:00
коммит произвёл GitHub
родитель 226d4b2ac8
Коммит 344836dfb2
10 изменённых файлов: 101 добавлений и 23 удалений

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

@@ -696,9 +696,7 @@ func TestS3TestConnection(t *testing.T) {
config.FileSettings.AmazonS3Bucket = "Wrong_bucket"
_, resp = th.SystemAdminClient.TestS3Connection(&config)
CheckInternalErrorStatus(t, resp)
if resp.Error.Message != "Unable to create bucket" {
t.Fatal("should return error ")
}
assert.Equal(t, "Unable to create bucket.", resp.Error.Message)
config.FileSettings.AmazonS3Bucket = "shouldcreatenewbucket"
_, resp = th.SystemAdminClient.TestS3Connection(&config)

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

@@ -985,14 +985,14 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
if *c.App.Config().ExperimentalSettings.ClientSideCertEnable {
if license := c.App.License(); license == nil || !*license.Features.SAML {
c.Err = model.NewAppError("ClientSideCertNotAllowed", "Attempt to use the experimental feature ClientSideCertEnable without a valid enterprise license", nil, "", http.StatusBadRequest)
c.Err = model.NewAppError("ClientSideCertNotAllowed", "api.user.login.client_side_cert.license.app_error", nil, "", http.StatusBadRequest)
return
} else {
certPem, certSubject, certEmail := c.App.CheckForClienSideCert(r)
mlog.Debug("Client Cert", mlog.String("cert_subject", certSubject), mlog.String("cert_email", certEmail))
if len(certPem) == 0 || len(certEmail) == 0 {
c.Err = model.NewAppError("ClientSideCertMissing", "Attempted to sign in using the experimental feature ClientSideCert without providing a valid certificate", nil, "", http.StatusBadRequest)
c.Err = model.NewAppError("ClientSideCertMissing", "api.user.login.client_side_cert.certificate.app_error", nil, "", http.StatusBadRequest)
return
} else if *c.App.Config().ExperimentalSettings.ClientSideCertCheck == model.CLIENT_SIDE_CERT_CHECK_PRIMARY_AUTH {
loginId = certEmail

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

@@ -1476,6 +1476,10 @@
"id": "api.file.move_file.rename.app_error",
"translation": "Unable to move file locally."
},
{
"id": "api.file.no_driver.app_error",
"translation": "No file driver selected."
},
{
"id": "api.file.read_file.configured.app_error",
"translation": "File storage not configured properly. Please configure for either S3 or local server file storage."
@@ -1488,6 +1492,22 @@
"id": "api.file.read_file.reading_local.app_error",
"translation": "Encountered an error reading from local server storage"
},
{
"id": "api.file.test_connection.local.connection.app_error",
"translation": "Don't have permissions to write to local path specified or other error."
},
{
"id": "api.file.test_connection.s3.connection.app_error",
"translation": "Bad connection to S3 or minio."
},
{
"id": "api.file.test_connection.s3.bucket_exists.app_error",
"translation": "Error checking if bucket exists."
},
{
"id": "api.file.test_connection.s3.bucked_create.app_error",
"translation": "Unable to create bucket."
},
{
"id": "api.file.upload_file.bad_parse.app_error",
"translation": "Unable to upload file. Header cannot be parsed."
@@ -2954,6 +2974,14 @@
"id": "api.user.login.blank_pwd.app_error",
"translation": "Password field must not be blank"
},
{
"id": "api.user.login.client_side_cert.license.app_error",
"translation": "Attempt to use the experimental feature ClientSideCertEnable without a valid enterprise license"
},
{
"id": "api.user.login.client_side_cert.certificate.app_error",
"translation": "Attempted to sign in using the experimental feature ClientSideCert without providing a valid certificate"
},
{
"id": "api.user.login.inactive.app_error",
"translation": "Login failed because your account has been deactivated. Please contact an administrator."
@@ -4850,10 +4878,30 @@
"id": "model.client.writer.app_error",
"translation": "Unable to build multipart request"
},
{
"id": "model.cluster.is_valid.create_at.app_error",
"translation": "CreateAt must be set"
},
{
"id": "model.cluster.is_valid.hostname.app_error",
"translation": "Hostname must be set"
},
{
"id": "model.cluster.is_valid.id.app_error",
"translation": "Invalid Id"
},
{
"id": "model.cluster.is_valid.last_ping_at.app_error",
"translation": "LastPingAt must be set"
},
{
"id": "model.cluster.is_valid.name.app_error",
"translation": "ClusterName must be set"
},
{
"id": "model.cluster.is_valid.type.app_error",
"translation": "Type must be set"
},
{
"id": "model.command.is_valid.create_at.app_error",
"translation": "Create at must be a valid time"
@@ -4954,6 +5002,10 @@
"id": "model.compliance.is_valid.start_end_at.app_error",
"translation": "To must be greater than From"
},
{
"id": "model.config.is_valid.allow_cookies_for_subdomains.app_error",
"translation": "Allowing cookies for subdomains requires SiteURL to be set."
},
{
"id": "model.config.is_valid.atmos_camo_image_proxy_options.app_error",
"translation": "Invalid atmos/camo image proxy options for service settings. Must be set to your shared key."
@@ -5414,6 +5466,10 @@
"id": "model.incoming_hook.id.app_error",
"translation": "Invalid Id"
},
{
"id": "model.incoming_hook.parse_data.app_error",
"translation": "Unable to parse incoming data"
},
{
"id": "model.incoming_hook.team_id.app_error",
"translation": "Invalid team ID"
@@ -6286,6 +6342,30 @@
"id": "store.sql_channel_member_history.permanent_delete_batch.app_error",
"translation": "Failed to purge records"
},
{
"id": "store.sql_cluster_discovery.save.app_error",
"translation": "Failed to save ClusterDiscovery row"
},
{
"id": "store.sql_cluster_discovery.delete.app_error",
"translation": "Failed to delete"
},
{
"id": "store.sql_cluster_discovery.exists.app_error",
"translation": "Failed to check if it exists"
},
{
"id": "store.sql_cluster_discovery.get_all.app_error",
"translation": "Failed to get all disoery rows"
},
{
"id": "store.sql_cluster_discovery.set_last_ping.app_error",
"translation": "Failed to update last ping at"
},
{
"id": "store.sql_cluster_discovery.cleanup.app_error",
"translation": "Failed to save ClusterDiscovery row"
},
{
"id": "store.sql_command.analytics_command_count.app_error",
"translation": "We couldn't count the commands"

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

@@ -90,23 +90,23 @@ func (o *ClusterDiscovery) IsValid() *AppError {
}
if len(o.ClusterName) == 0 {
return NewAppError("ClusterDiscovery.IsValid", "ClusterName must be set", nil, "", http.StatusBadRequest)
return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.name.app_error", nil, "", http.StatusBadRequest)
}
if len(o.Type) == 0 {
return NewAppError("ClusterDiscovery.IsValid", "Type must be set", nil, "", http.StatusBadRequest)
return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.type.app_error", nil, "", http.StatusBadRequest)
}
if len(o.Hostname) == 0 {
return NewAppError("ClusterDiscovery.IsValid", "Hostname must be set", nil, "", http.StatusBadRequest)
return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.hostname.app_error", nil, "", http.StatusBadRequest)
}
if o.CreateAt == 0 {
return NewAppError("ClusterDiscovery.IsValid", "CreateAt must be set", nil, "", http.StatusBadRequest)
return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.create_at.app_error", nil, "", http.StatusBadRequest)
}
if o.LastPingAt == 0 {
return NewAppError("ClusterDiscovery.IsValid", "LastPingAt must be set", nil, "", http.StatusBadRequest)
return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.last_ping_at.app_error", nil, "", http.StatusBadRequest)
}
return nil

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

@@ -1946,7 +1946,7 @@ func (o *Config) IsValid() *AppError {
}
if len(*o.ServiceSettings.SiteURL) == 0 && *o.ServiceSettings.AllowCookiesForSubdomains {
return NewAppError("Config.IsValid", "Allowing cookies for subdomains requires SiteURL to be set.", nil, "", http.StatusBadRequest)
return NewAppError("Config.IsValid", "model.config.is_valid.allow_cookies_for_subdomains.app_error", nil, "", http.StatusBadRequest)
}
if err := o.TeamSettings.isValid(); err != nil {

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

@@ -197,7 +197,7 @@ func IncomingWebhookRequestFromJson(data io.Reader) (*IncomingWebhookRequest, *A
if err != nil {
o, err = decodeIncomingWebhookRequest(escapeControlCharsFromPayload(by))
if err != nil {
return nil, NewAppError("IncomingWebhookRequestFromJson", "Unable to parse incoming data", nil, err.Error(), http.StatusBadRequest)
return nil, NewAppError("IncomingWebhookRequestFromJson", "model.incoming_hook.parse_data.app_error", nil, err.Error(), http.StatusBadRequest)
}
}

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

@@ -36,7 +36,7 @@ func (s sqlClusterDiscoveryStore) Save(ClusterDiscovery *model.ClusterDiscovery)
}
if err := s.GetMaster().Insert(ClusterDiscovery); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "Failed to save ClusterDiscovery row", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "store.sql_cluster_discovery.save.app_error", nil, err.Error(), http.StatusInternalServerError)
}
})
}
@@ -61,7 +61,7 @@ func (s sqlClusterDiscoveryStore) Delete(ClusterDiscovery *model.ClusterDiscover
"Hostname": ClusterDiscovery.Hostname,
},
); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Delete", "Failed to delete", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Delete", "store.sql_cluster_discovery.delete.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
if count > 0 {
result.Data = true
@@ -91,7 +91,7 @@ func (s sqlClusterDiscoveryStore) Exists(ClusterDiscovery *model.ClusterDiscover
"Hostname": ClusterDiscovery.Hostname,
},
); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Exists", "Failed to check if it exists", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Exists", "store.sql_cluster_discovery.exists.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
if count > 0 {
result.Data = true
@@ -123,7 +123,7 @@ func (s sqlClusterDiscoveryStore) GetAll(ClusterDiscoveryType, clusterName strin
"LastPingAt": lastPingAt,
},
); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "Failed to get all disoery rows", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "store.sql_cluster_discovery.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
result.Data = list
}
@@ -149,7 +149,7 @@ func (s sqlClusterDiscoveryStore) SetLastPingAt(ClusterDiscovery *model.ClusterD
"Hostname": ClusterDiscovery.Hostname,
},
); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "Failed to update last ping at", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "store.sql_cluster_discovery.set_last_ping.app_error", nil, err.Error(), http.StatusInternalServerError)
}
})
}
@@ -166,7 +166,7 @@ func (s sqlClusterDiscoveryStore) Cleanup() store.StoreChannel {
"LastPingAt": model.GetMillis() - model.CDS_OFFLINE_AFTER_MILLIS,
},
); err != nil {
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "Failed to save ClusterDiscovery row", nil, err.Error(), http.StatusInternalServerError)
result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "store.sql_cluster_discovery.cleanup.app_error", nil, err.Error(), http.StatusInternalServerError)
}
})
}

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

@@ -42,5 +42,5 @@ func NewFileBackend(settings *model.FileSettings, enableComplianceFeatures bool)
directory: settings.Directory,
}, nil
}
return nil, model.NewAppError("NewFileBackend", "No file driver selected.", nil, "", http.StatusInternalServerError)
return nil, model.NewAppError("NewFileBackend", "api.file.no_driver.app_error", nil, "", http.StatusInternalServerError)
}

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

@@ -26,7 +26,7 @@ type LocalFileBackend struct {
func (b *LocalFileBackend) TestConnection() *model.AppError {
f := bytes.NewReader([]byte("testingwrite"))
if _, err := writeFileLocally(f, filepath.Join(b.directory, TEST_FILE_PATH)); err != nil {
return model.NewAppError("TestFileConnection", "Don't have permissions to write to local path specified or other error.", nil, err.Error(), http.StatusInternalServerError)
return model.NewAppError("TestFileConnection", "api.file.test_connection.local.connection.app_error", nil, err.Error(), http.StatusInternalServerError)
}
os.Remove(filepath.Join(b.directory, TEST_FILE_PATH))
mlog.Info("Able to write files to local storage.")

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

@@ -62,12 +62,12 @@ func (b *S3FileBackend) s3New() (*s3.Client, error) {
func (b *S3FileBackend) TestConnection() *model.AppError {
s3Clnt, err := b.s3New()
if err != nil {
return model.NewAppError("TestFileConnection", "Bad connection to S3 or minio.", nil, err.Error(), http.StatusInternalServerError)
return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.connection.app_error", nil, err.Error(), http.StatusInternalServerError)
}
exists, err := s3Clnt.BucketExists(b.bucket)
if err != nil {
return model.NewAppError("TestFileConnection", "Error checking if bucket exists.", nil, err.Error(), http.StatusInternalServerError)
return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.bucket_exists.app_error", nil, err.Error(), http.StatusInternalServerError)
}
if !exists {
@@ -75,7 +75,7 @@ func (b *S3FileBackend) TestConnection() *model.AppError {
err := s3Clnt.MakeBucket(b.bucket, b.region)
if err != nil {
mlog.Error("Unable to create bucket.")
return model.NewAppError("TestFileConnection", "Unable to create bucket", nil, err.Error(), http.StatusInternalServerError)
return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.bucked_create.app_error", nil, err.Error(), http.StatusInternalServerError)
}
}
mlog.Info("Connection to S3 or minio is good. Bucket exists.")