summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/file.go35
-rw-r--r--api/post.go18
-rw-r--r--i18n/en.json28
-rw-r--r--i18n/es.json4
-rw-r--r--web/react/components/admin_console/ldap_settings.jsx6
-rw-r--r--web/static/i18n/en.json14
-rw-r--r--web/static/i18n/es.json10
-rw-r--r--web/static/i18n/pt.json6
8 files changed, 100 insertions, 21 deletions
diff --git a/api/file.go b/api/file.go
index 0011afd5b..9150e4bfe 100644
--- a/api/file.go
+++ b/api/file.go
@@ -547,6 +547,41 @@ func writeFile(f []byte, path string) *model.AppError {
return nil
}
+func moveFile(oldPath, newPath string) *model.AppError {
+ if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
+ fileData := make(chan []byte)
+ getFileAndForget(oldPath, fileData)
+ fileBytes := <-fileData
+
+ if fileBytes == nil {
+ return model.NewLocAppError("moveFile", "api.file.move_file.get_from_s3.app_error", nil, "")
+ }
+
+ var auth aws.Auth
+ auth.AccessKey = utils.Cfg.FileSettings.AmazonS3AccessKeyId
+ auth.SecretKey = utils.Cfg.FileSettings.AmazonS3SecretAccessKey
+
+ s := s3.New(auth, awsRegion())
+ bucket := s.Bucket(utils.Cfg.FileSettings.AmazonS3Bucket)
+
+ if err := bucket.Del(oldPath); err != nil {
+ return model.NewLocAppError("moveFile", "api.file.move_file.delete_from_s3.app_error", nil, err.Error())
+ }
+
+ if err := writeFile(fileBytes, newPath); err != nil {
+ return err
+ }
+ } else if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL {
+ if err := os.Rename(utils.Cfg.FileSettings.Directory+oldPath, utils.Cfg.FileSettings.Directory+newPath); err != nil {
+ return model.NewLocAppError("moveFile", "api.file.move_file.rename.app_error", nil, err.Error())
+ }
+ } else {
+ return model.NewLocAppError("moveFile", "api.file.move_file.configured.app_error", nil, "")
+ }
+
+ return nil
+}
+
func writeFileLocally(f []byte, path string) *model.AppError {
if err := os.MkdirAll(filepath.Dir(path), 0774); err != nil {
return model.NewLocAppError("writeFile", "api.file.write_file_locally.create_dir.app_error", nil, err.Error())
diff --git a/api/post.go b/api/post.go
index e6560a8e8..cd78b16f0 100644
--- a/api/post.go
+++ b/api/post.go
@@ -1094,6 +1094,7 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
message.Add("post", post.ToJson())
PublishAndForget(message)
+ DeletePostFilesAndForget(c.Session.TeamId, post)
result := make(map[string]string)
result["id"] = postId
@@ -1101,6 +1102,23 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func DeletePostFilesAndForget(teamId string, post *model.Post) {
+ go func() {
+ if len(post.Filenames) == 0 {
+ return
+ }
+
+ prefix := "teams/" + teamId + "/channels/" + post.ChannelId + "/users/" + post.UserId + "/"
+ for _, filename := range post.Filenames {
+ splitUrl := strings.Split(filename, "/")
+ oldPath := prefix + splitUrl[len(splitUrl)-2] + "/" + splitUrl[len(splitUrl)-1]
+ newPath := prefix + splitUrl[len(splitUrl)-2] + "/deleted_" + splitUrl[len(splitUrl)-1]
+ moveFile(oldPath, newPath)
+ }
+
+ }()
+}
+
func getPostsBefore(c *Context, w http.ResponseWriter, r *http.Request) {
getPostsBeforeOrAfter(c, w, r, true)
}
diff --git a/i18n/en.json b/i18n/en.json
index 5b261a770..6ac5ce5c2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -456,8 +456,24 @@
"translation": "S3 is not supported for local storage export."
},
{
- "id": "api.export.write_file.app_error",
- "translation": "Unable to write to export file"
+ "id": "api.file.move_file.get_from_s3.app_error",
+ "translation": "Unable to get file from S3."
+ },
+ {
+ "id": "api.file.move_file.delete_from_s3.app_error",
+ "translation": "Unable to delete file from S3."
+ },
+ {
+ "id": "api.file.move_file.rename.app_error",
+ "translation": "Unable to move file locally."
+ },
+ {
+ "id": "api.file.move_file.configured.app_error",
+ "translation": "File storage not configured properly. Please configure for either S3 or local server file storage."
+ },
+ {
+ "id": "api.file.file_upload.exceeds",
+ "translation": "File exceeds max image size."
},
{
"id": "api.file.file_upload.exceeds",
@@ -2408,6 +2424,10 @@
"translation": "Pinging sql %v database"
},
{
+ "id": "store.sql.read_replicas_not_licensed.critical",
+ "translation": "More than 1 read replica functionality disabled by current license. Please contact your system administrator about upgrading your enterprise license."
+ },
+ {
"id": "store.sql.remove_index.critical",
"translation": "Failed to remove index %v"
},
@@ -2428,10 +2448,6 @@
"translation": "Attempting to upgrade the database schema version to %v"
},
{
- "id": "store.sql.read_replicas_not_licensed.critical",
- "translation": "More than 1 read replica functionality disabled by current license. Please contact your system administrator about upgrading your enterprise license."
- },
- {
"id": "store.sql.schema_version.critical",
"translation": "The database schema version of %v cannot be upgraded. You must not skip a version."
},
diff --git a/i18n/es.json b/i18n/es.json
index 6670b7f5b..6443d18dc 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -2408,6 +2408,10 @@
"translation": "Verificando conexión con la base de datos sql %v"
},
{
+ "id": "store.sql.read_replicas_not_licensed.critical",
+ "translation": "La funcionalidad de más de 1 replica ha sido deshabilitada debido a la licencia actual. Por favor contacta a un administrador del sistema para realizar una actualización a la edición Enterprise."
+ },
+ {
"id": "store.sql.remove_index.critical",
"translation": "Falla al remover el índice %v"
},
diff --git a/web/react/components/admin_console/ldap_settings.jsx b/web/react/components/admin_console/ldap_settings.jsx
index 535c264dd..4cd19c886 100644
--- a/web/react/components/admin_console/ldap_settings.jsx
+++ b/web/react/components/admin_console/ldap_settings.jsx
@@ -20,7 +20,7 @@ var holders = defineMessages({
},
baseEx: {
id: 'admin.ldap.baseEx',
- defaultMessage: 'Ex "dc=mydomain,dc=com"'
+ defaultMessage: 'Ex "ou=Unit Name,dc=corp,dc=example,dc=com"'
},
firstnameAttrEx: {
id: 'admin.ldap.firstnameAttrEx',
@@ -32,7 +32,7 @@ var holders = defineMessages({
},
emailAttrEx: {
id: 'admin.ldap.emailAttrEx',
- defaultMessage: 'Ex "mail"'
+ defaultMessage: 'Ex "mail" or "userPrincipalName"'
},
usernameAttrEx: {
id: 'admin.ldap.usernameAttrEx',
@@ -581,4 +581,4 @@ LdapSettings.propTypes = {
config: React.PropTypes.object
};
-export default injectIntl(LdapSettings); \ No newline at end of file
+export default injectIntl(LdapSettings);
diff --git a/web/static/i18n/en.json b/web/static/i18n/en.json
index 236a6c282..58a19ea1b 100644
--- a/web/static/i18n/en.json
+++ b/web/static/i18n/en.json
@@ -152,14 +152,14 @@
"admin.ldap.bannerDesc": "If a user attribute changes on the LDAP server it will be updated the next time the user enters their credentials to log in to Mattermost. This includes if a user is made inactive or removed from an LDAP server. Synchronization with LDAP servers is planned in a future release.",
"admin.ldap.bannerHeading": "Note:",
"admin.ldap.baseDesc": "The Base DN is the Distinguished Name of the location where Mattermost should start its search for users in the LDAP tree.",
- "admin.ldap.baseEx": "Ex \"dc=mydomain,dc=com\"",
+ "admin.ldap.baseEx": "Ex \"ou=Unit Name,dc=corp,dc=example,dc=com\"",
"admin.ldap.baseTitle": "BaseDN:",
"admin.ldap.bindPwdDesc": "Password of the user given in \"Bind Username\".",
"admin.ldap.bindPwdTitle": "Bind Password:",
"admin.ldap.bindUserDesc": "The username used to perform the LDAP search. This should typically be an account created specifically for use with Mattermost. It should have access limited to read the portion of the LDAP tree specified in the BaseDN field.",
"admin.ldap.bindUserTitle": "Bind Username:",
"admin.ldap.emailAttrDesc": "The attribute in the LDAP server that will be used to populate the email addresses of users in Mattermost.",
- "admin.ldap.emailAttrEx": "Ex \"mail\"",
+ "admin.ldap.emailAttrEx": "Ex \"mail\" or \"userPrincipalName\"",
"admin.ldap.emailAttrTitle": "Email Attribute:",
"admin.ldap.enableDesc": "When true, Mattermost allows login using LDAP",
"admin.ldap.enableTitle": "Enable Login With LDAP:",
@@ -737,6 +737,11 @@
"invite_member.send2": "Send Invitations",
"invite_member.sending": " Sending",
"invite_member.teamInviteLink": "You can also invite people using the {link}.",
+ "ldap_signup.find": "Find my teams",
+ "ldap_signup.ldap": "Create team with LDAP Account",
+ "ldap_signup.length_error": "Name must be 3 or more characters up to a maximum of 15",
+ "ldap_signup.teamName": "Enter name of new team",
+ "ldap_signup.team_error": "Please enter a team name",
"loading_screen.loading": "Loading",
"login.changed": " Sign-in method changed successfully",
"login.create": "Create one now",
@@ -965,11 +970,6 @@
"sso_signup.length_error": "Name must be 3 or more characters up to a maximum of 15",
"sso_signup.teamName": "Enter name of new team",
"sso_signup.team_error": "Please enter a team name",
- "ldap_signup.find": "Find my teams",
- "ldap_signup.ldap": "Create team with LDAP Account",
- "ldap_signup.length_error": "Name must be 3 or more characters up to a maximum of 15",
- "ldap_signup.teamName": "Enter name of new team",
- "ldap_signup.team_error": "Please enter a team name",
"suggestion.mention.all": "Notifies everyone in the team",
"suggestion.mention.channel": "Notifies everyone in the channel",
"suggestion.search.private": "Private Groups",
diff --git a/web/static/i18n/es.json b/web/static/i18n/es.json
index 0f3bc02d7..89326bff3 100644
--- a/web/static/i18n/es.json
+++ b/web/static/i18n/es.json
@@ -152,14 +152,14 @@
"admin.ldap.bannerDesc": "Si el atributo de un usuario cambia en el servidor LDAP será actualizado la próxima vez que el usuario ingrese sus credenciales para iniciar sesión en Mattermost. Esto incluye si un usuario se inactiva o se remueve en el servidor LDAP. Sincronización con servidores LDAP está planificado para futuras versiones.",
"admin.ldap.bannerHeading": "Nota:",
"admin.ldap.baseDesc": "El DN Base es el Nombre Distinguido de la ubicación donde Mattermost debe comenzar a buscar a los usuarios en el árbol del LDAP.",
- "admin.ldap.baseEx": "Ex \"dc=midominio,dc=com\"",
+ "admin.ldap.baseEx": "Ej \"ou=Unit Name,dc=corp,dc=example,dc=com\"",
"admin.ldap.baseTitle": "DN Base:",
"admin.ldap.bindPwdDesc": "Contraseña del usuario asignado en \"Usuario de Enlace\".",
"admin.ldap.bindPwdTitle": "Contraseña de Enlace:",
"admin.ldap.bindUserDesc": "El usuario que realizará las busquedas LDAP. Normalmente este debería ser una cuenta específicamente creada para ser utilizada por Mattermost. Debería contat con acceso limitado para leer la porción del árbol LDAP especificada en el campo DN Base.",
"admin.ldap.bindUserTitle": "Usuario de Enlace:",
"admin.ldap.emailAttrDesc": "El atributo en el servidor LDAP que será utilizado para poblar la dirección de correo electrónico de los usuarios en Mattermost.",
- "admin.ldap.emailAttrEx": "Ej \"mail\"",
+ "admin.ldap.emailAttrEx": "Ej \"mail\" o \"userPrincipalName\"",
"admin.ldap.emailAttrTitle": "Atributo de Correo Electrónico:",
"admin.ldap.enableDesc": "Cuando es verdadero, Mattermost permite realizar inicio de sesión utilizando LDAP",
"admin.ldap.enableTitle": "Habilitar inicio de sesión con LDAP:",
@@ -593,6 +593,7 @@
"choose_auth_page.find": "Encontrar mi equipo",
"choose_auth_page.gitlabCreate": "Crear un nuevo equipo con una cuenta de GitLab",
"choose_auth_page.googleCreate": "Crear un nuevo equipo con una cuenta de Google Apps",
+ "choose_auth_page.ldapCreate": "Crea un nuevo equipo con tu cuenta de LDAP",
"choose_auth_page.noSignup": "No hay métodos de inicio de sesión configurad, por favor contacte al administrador de sistemasos",
"claim.account.noEmail": "No se especifico un correo electrónico.",
"claim.email_to_sso.enterPwd": "Ingresa la contraseña para tu cuenta para {team} {site}",
@@ -736,6 +737,11 @@
"invite_member.send2": "Enviar Invitaciones",
"invite_member.sending": " Enviando",
"invite_member.teamInviteLink": "También puedes invitar personas usando el {link}.",
+ "ldap_signup.find": "Encontrar mis equipos",
+ "ldap_signup.ldap": "Crea un equipo con tu cuenta de LDAP",
+ "ldap_signup.length_error": "El nombre debe tener entre 3 y 15 caracteres",
+ "ldap_signup.teamName": "Ingresa el nombre del nuevo equipo",
+ "ldap_signup.team_error": "Por favor ingresa el nombre del equipo",
"loading_screen.loading": "Cargando",
"login.changed": " Cambiado el método de inicio de sesión satisfactoriamente",
"login.create": "Crea una ahora",
diff --git a/web/static/i18n/pt.json b/web/static/i18n/pt.json
index f4b998ded..b8c372bdd 100644
--- a/web/static/i18n/pt.json
+++ b/web/static/i18n/pt.json
@@ -152,14 +152,14 @@
"admin.ldap.bannerDesc": "Se um atributo de usuário de mudar no servidor LDAP, ele será atualizado na próxima vez que o usuário inserir suas credenciais para iniciar sessão no Mattermost. Isso inclui se um usuário estiver inativo ou removido de um servidor LDAP. Sincronização com servidores LDAP está prevista para um lançamento futuro.",
"admin.ldap.bannerHeading": "Nota:",
"admin.ldap.baseDesc": "Base DN é o nome distinto do local onde Mattermost deve começar sua busca para os usuários na árvore LDAP.",
- "admin.ldap.baseEx": "Ex \"dc=mydomain,dc=com\"",
+ "admin.ldap.baseEx": "Ex \"ou=Unit Name,dc=corp,dc=example,dc=com\"",
"admin.ldap.baseTitle": "BaseDN:",
"admin.ldap.bindPwdDesc": "Senha do usuário fornecido em \"Bind Username\".",
"admin.ldap.bindPwdTitle": "Vincular Senha:",
"admin.ldap.bindUserDesc": "O nome de usuário usado para realizar a pesquisa LDAP. Isso deve ser tipicamente uma conta criada especificamente para uso do Mattermost. Deve ter acesso limitado a ler a parte da árvore LDAP especificado no campo BaseDN.",
"admin.ldap.bindUserTitle": "Bind Username:",
"admin.ldap.emailAttrDesc": "O atributo no servidor LDAP que será usado para preencher os endereços de e-mail de usuários no Mattermost.",
- "admin.ldap.emailAttrEx": "Ex \"mail\"",
+ "admin.ldap.emailAttrEx": "Ex \"mail\" ou \"userPrincipalName\"",
"admin.ldap.emailAttrTitle": "Atributo de E-mail:",
"admin.ldap.enableDesc": "Quando verdadeiro, Mattermost permite login utilizando LDAP",
"admin.ldap.enableTitle": "Ativar Login With LDAP:",
@@ -1288,4 +1288,4 @@
"view_image_popover.download": "Download",
"view_image_popover.file": "Arquivo {count} de {total}",
"view_image_popover.publicLink": "Obter O Link Público"
-} \ No newline at end of file
+}