From 82291d44535d74aae5da7ecb547d3ee8ef8baf31 Mon Sep 17 00:00:00 2001
From: RuslanTarasov
Date: Fri, 18 Aug 2017 12:28:55 +0300
Subject: [PATCH] upgrade version from 9.1.0 to 9.1.1
---
build/install/deb/Files/god/conf.d/nginx.god | 5 +-
...-communityserver-common-init.conf.template | 43 ++
...e-communityserver-common-ssl.conf.template | 120 ++++
...ffice-communityserver-common.conf.template | 38 ++
...office-communityserver-nginx.conf.template | 32 +
.../deb/Files/tools/default-onlyoffice-ssl.sh | 49 ++
.../deb/Files/tools/default-onlyoffice.sh | 12 +
build/install/deb/Files/tools/letsencrypt.sh | 25 +
.../debian/onlyoffice-communityserver.install | 1 +
build/install/deb/debian/postinst | 66 +-
...-communityserver-common-init.conf.template | 43 ++
...e-communityserver-common-ssl.conf.template | 120 ++++
.../onlyoffice-communityserver-common.conf | 5 +-
...ffice-communityserver-common.conf.template | 38 ++
...office-communityserver-nginx.conf.template | 32 +
...server-proxy-to-controlpanel.conf.template | 5 +-
.../rpm/Files/tools/default-onlyoffice-ssl.sh | 49 ++
.../rpm/Files/tools/default-onlyoffice.sh | 12 +
build/install/rpm/Files/tools/letsencrypt.sh | 25 +
build/install/rpm/onlyoffice.spec | 7 +-
.../Tasks/Modules/CrmModuleSpecifics.cs | 2 +
.../ASC.Api.Mail/MailApi.MailService.cs | 92 ++-
.../ASC.Api/ASC.Specific/ASC.Specific.csproj | 8 +
.../CapabilitiesApi/CapabilitiesEntryPoint.cs | 36 +-
.../GoogleDrive/GoogleDriveStorage.cs | 29 +-
...C.Mail.Aggregator.CollectionService.csproj | 1 +
.../AggregatorService.cs | 50 +-
.../Queue/Data/TaskData.cs | 18 +
module/ASC.MessagingSystem/MessageAction.cs | 2 +-
.../WhiteLabel/TenantInfoSettings.cs | 21 +
.../WhiteLabel/TenantLogoManager.cs | 66 +-
.../WhiteLabel/TenantWhiteLabelSettings.cs | 43 ++
web/studio/ASC.Web.Studio/About.aspx | 2 +-
.../Core/Notify/NotifyConfiguration.cs | 75 ++-
.../Products/Files/ASC.Web.Files.csproj | 11 -
.../Controls/AccessRights/accessrights.js | 53 +-
.../Controls/EmptyFolder/EmptyFolder.ascx | 2 +-
.../Products/Files/Helpers/Global.cs | 2 -
.../ClientScripts/FilesConstantsResources.cs | 2 -
.../Resources/FilesCommonResource.Designer.cs | 18 -
.../Files/Resources/FilesCommonResource.resx | 6 -
.../Resources/FilesJSResource.Designer.cs | 30 +-
.../Files/Resources/FilesJSResource.resx | 14 +-
.../Resources/FilesUCResource.Designer.cs | 36 -
.../Files/Resources/FilesUCResource.resx | 12 -
.../FilesPatternResource.Designer.cs | 22 -
.../NotifyService/FilesPatternResource.resx | 10 -
.../Services/NotifyService/NotifyClient.cs | 26 -
.../Services/NotifyService/NotifyConstants.cs | 2 -
.../Services/NotifyService/NotifySource.cs | 3 +-
.../Files/Services/NotifyService/patterns.xml | 16 -
.../FileStorageServiceController.cs | 39 --
.../WCFService/IFileStorageService.cs | 2 -
.../Products/Files/js/servicemanager.js | 6 -
.../ASC.Web.Studio/Products/Files/js/ui.js | 5 +-
.../Products/People/ASC.Web.People.csproj | 8 +-
.../ProjectsTemplates/ListTasksTemplates.html | 22 +-
.../Common/AuthorizeDocs/js/authorizedocs.js | 2 +-
.../Common/AuthorizeDocs/js/reviews.json | 390 +++--------
.../Users/UserProfile/css/images/flags.png | Bin 4026 -> 6770 bytes
.../Users/UserProfile/css/userlanguages.less | 1 +
.../ASC.Web.Studio/Web.consumers.config | 4 +
.../addons/calendar/ASC.Web.Calendar.csproj | 12 +-
.../addons/mail/ASC.Web.Mail.csproj | 12 +-
.../ASC.Web.Studio/addons/talk/Default.aspx | 2 +-
.../talk/UserControls/ContactsContainer.ascx | 1 +
.../talk/UserControls/RoomsContainer.ascx | 23 +-
.../talk/UserControls/TabsContainerPart.ascx | 14 +-
.../talk/css/default/imagescss/chatsmiles.png | Bin 786 -> 363 bytes
.../talk/css/default/imagescss/groupchat.png | Bin 874 -> 309 bytes
.../css/default/imagescss/groupchat_tab.png | Bin 0 -> 255 bytes
.../talk/css/default/imagescss/logo-label.png | Bin 0 -> 826 bytes
.../talk/css/default/imagescss/logo.png | Bin 0 -> 561 bytes
.../talk/css/default/imagescss/mailing.png | Bin 0 -> 173 bytes
.../talk/css/default/imagescss/search-msg.png | Bin 671 -> 321 bytes
.../talk/css/default/imagescss/sendfile.png | Bin 757 -> 389 bytes
.../talk/css/default/imagescss/settings.png | Bin 954 -> 322 bytes
.../addons/talk/css/default/talk.style.css | 619 +++++++++++++-----
.../addons/talk/js/talk.common.js | 105 +--
.../addons/talk/js/talk.contactscontainer.js | 251 ++++++-
.../addons/talk/js/talk.default.js | 3 +
.../addons/talk/js/talk.meseditorcontainer.js | 4 +-
.../addons/talk/js/talk.navigationitem.js | 3 +-
.../addons/talk/js/talk.roomscontainer.js | 13 +-
.../addons/talk/js/talk.tabscontainer.js | 54 +-
.../js/asc/plugins/jquery.tlcombobox.js | 12 -
.../ASC.Web.Studio/web.appsettings.config | 2 +-
87 files changed, 2015 insertions(+), 1031 deletions(-)
create mode 100644 build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-init.conf.template
create mode 100644 build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template
create mode 100644 build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
create mode 100644 build/install/deb/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
create mode 100644 build/install/deb/Files/tools/default-onlyoffice-ssl.sh
create mode 100644 build/install/deb/Files/tools/default-onlyoffice.sh
create mode 100644 build/install/deb/Files/tools/letsencrypt.sh
create mode 100644 build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common-init.conf.template
create mode 100644 build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template
create mode 100644 build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
create mode 100644 build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
create mode 100644 build/install/rpm/Files/tools/default-onlyoffice-ssl.sh
create mode 100644 build/install/rpm/Files/tools/default-onlyoffice.sh
create mode 100644 build/install/rpm/Files/tools/letsencrypt.sh
create mode 100644 module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/Queue/Data/TaskData.cs
create mode 100644 web/studio/ASC.Web.Studio/addons/talk/css/default/imagescss/groupchat_tab.png
create mode 100644 web/studio/ASC.Web.Studio/addons/talk/css/default/imagescss/logo-label.png
create mode 100644 web/studio/ASC.Web.Studio/addons/talk/css/default/imagescss/logo.png
create mode 100644 web/studio/ASC.Web.Studio/addons/talk/css/default/imagescss/mailing.png
diff --git a/build/install/deb/Files/god/conf.d/nginx.god b/build/install/deb/Files/god/conf.d/nginx.god
index 0442f7490..c5c2fd2e4 100644
--- a/build/install/deb/Files/god/conf.d/nginx.god
+++ b/build/install/deb/Files/god/conf.d/nginx.god
@@ -7,11 +7,12 @@ God.watch do |w|
w.restart = "/etc/init.d/nginx restart"
w.pid_file = "/var/run/nginx.pid"
w.behavior(:clean_pid_file)
-
+ w.keepalive
+
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 10.seconds
c.running = false
end
end
-end
\ No newline at end of file
+end
diff --git a/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-init.conf.template b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-init.conf.template
new file mode 100644
index 000000000..e713c3312
--- /dev/null
+++ b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-init.conf.template
@@ -0,0 +1,43 @@
+upstream fastcgi_backend {
+ server unix:/var/run/onlyoffice/onlyoffice.socket;
+ keepalive 32;
+}
+
+server {
+ listen 80;
+
+ fastcgi_keep_conn on;
+ fastcgi_index Default.aspx;
+ fastcgi_intercept_errors on;
+
+
+ include fastcgi_params;
+
+ fastcgi_param HTTP_X_REWRITER_URL $http_x_rewriter_url;
+ fastcgi_param SERVER_NAME $host;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param PATH_INFO "";
+
+ fastcgi_read_timeout 600;
+ fastcgi_send_timeout 600;
+
+
+ location / {
+ root /var/www/onlyoffice/WebStudio/;
+ expires 0;
+ add_header Cache-Control no-cache;
+ rewrite ^(.*)$ /StartConfigure.htm break;
+ }
+
+ location /api {
+ fastcgi_pass fastcgi_backend;
+ break;
+ }
+
+ location ~* ^/(warmup[2-9]?)/ {
+ rewrite /warmup([^/]*)/(.*) /$2 break;
+ fastcgi_pass unix:/var/run/onlyoffice/onlyoffice$1.socket;
+ }
+}
+
+
diff --git a/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template
new file mode 100644
index 000000000..f422bc157
--- /dev/null
+++ b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template
@@ -0,0 +1,120 @@
+upstream fastcgi_backend_apisystem {
+ server unix:/var/run/onlyoffice/onlyofficeApiSystem.socket;
+ keepalive 32;
+}
+
+upstream fastcgi_backend {
+ server unix:/var/run/onlyoffice/onlyoffice.socket;
+ keepalive {{ONLYOFFICE_NIGNX_KEEPLIVE}};
+}
+
+fastcgi_cache_path /var/cache/nginx/onlyoffice
+ levels=1:2
+ keys_zone=onlyoffice:16m
+ max_size=256m
+ inactive=1d;
+
+geo $ip_external {
+ default 1;
+ {{DOCKER_ONLYOFFICE_SUBNET}} 0;
+ 127.0.0.1 0;
+}
+
+map $http_host $this_host {
+ "" $host;
+ default $http_host;
+}
+
+map $http_x_forwarded_proto $the_scheme {
+ default $http_x_forwarded_proto;
+ "" $scheme;
+}
+
+map $http_x_forwarded_host $the_host {
+ default $http_x_forwarded_host;
+ "" $this_host;
+}
+
+## Normal HTTP host
+server {
+ listen 0.0.0.0:80;
+ listen [::]:80 default_server;
+ server_name _;
+ server_tokens off;
+
+ root /nowhere; ## root doesn't have to be a valid path since we are redirecting
+
+ location / {
+ if ($ip_external) {
+ ## Redirects all traffic to the HTTPS host
+ rewrite ^ https://$host$request_uri? permanent;
+ }
+
+
+ client_max_body_size 100m;
+
+ proxy_pass https://127.0.0.1;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Host $server_name;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_ssl_verify off;
+ }
+}
+
+## HTTPS host
+server {
+ listen 0.0.0.0:443 ssl http2;
+ listen [::]:443 ssl http2 default_server;
+ server_tokens off;
+ root /usr/share/nginx/html;
+
+ ## Increase this if you want to upload large attachments
+ client_max_body_size 100m;
+
+ ## Strong SSL Security
+ ## https://cipherli.st/
+ ssl on;
+ ssl_certificate {{SSL_CERTIFICATE_PATH}};
+ ssl_certificate_key {{SSL_KEY_PATH}};
+ ssl_verify_client {{SSL_VERIFY_CLIENT}};
+ ssl_client_certificate {{CA_CERTIFICATES_PATH}};
+
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+ ssl_prefer_server_ciphers on;
+ ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
+ ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
+ ssl_session_cache shared:SSL:10m;
+ ssl_session_tickets off; # Requires nginx >= 1.5.9
+
+ add_header Strict-Transport-Security "max-age={{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}; includeSubDomains; preload" always;
+# add_header X-Frame-Options DENY;
+ add_header X-Content-Type-Options nosniff;
+ add_header Access-Control-Allow-Origin *;
+
+ ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
+ ## Replace with your ssl_trusted_certificate. For more info see:
+ ## - https://medium.com/devops-programming/4445f4862461
+ ## - https://www.ruby-forum.com/topic/4419319
+ ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
+ ssl_stapling on;
+ ssl_stapling_verify on;
+ ssl_trusted_certificate {{SSL_OCSP_CERTIFICATE_PATH}};
+ resolver 8.8.8.8 8.8.4.4 127.0.0.11 valid=300s; # Can change to your DNS resolver if desired
+ resolver_timeout 10s;
+
+ ## [Optional] Generate a stronger DHE parameter:
+ ## cd /etc/ssl/certs
+ ## sudo openssl dhparam -out dhparam.pem 4096
+ ##
+ ssl_dhparam {{SSL_DHPARAM_PATH}};
+
+ include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
+}
+
+
+
diff --git a/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common.conf.template b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
new file mode 100644
index 000000000..c86174e1c
--- /dev/null
+++ b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
@@ -0,0 +1,38 @@
+upstream fastcgi_backend_apisystem {
+ server unix:/var/run/onlyoffice/onlyofficeApiSystem.socket;
+ keepalive 32;
+}
+
+upstream fastcgi_backend {
+ server unix:/var/run/onlyoffice/onlyoffice.socket;
+ keepalive {{ONLYOFFICE_NIGNX_KEEPLIVE}};
+}
+
+fastcgi_cache_path /var/cache/nginx/onlyoffice
+ levels=1:2
+ keys_zone=onlyoffice:16m
+ max_size=256m
+ inactive=1d;
+
+map $http_host $this_host {
+ "" $host;
+ default $http_host;
+}
+
+map $http_x_forwarded_proto $the_scheme {
+ default $http_x_forwarded_proto;
+ "" $scheme;
+}
+
+map $http_x_forwarded_host $the_host {
+ default $http_x_forwarded_host;
+ "" $this_host;
+}
+
+server {
+ listen 80;
+
+ add_header Access-Control-Allow-Origin *;
+
+ include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
+}
diff --git a/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
new file mode 100644
index 000000000..a61a6b92d
--- /dev/null
+++ b/build/install/deb/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
@@ -0,0 +1,32 @@
+user nginx;
+worker_processes auto;
+
+error_log /var/log/nginx/error.log warn;
+pid /var/run/nginx.pid;
+
+
+events {
+ worker_connections 1024;
+}
+
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /var/log/nginx/access.log main;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ keepalive_timeout 65;
+
+ #gzip on;
+ include /etc/nginx/sites-enabled/*;
+ include /etc/nginx/conf.d/*.conf;
+}
+
diff --git a/build/install/deb/Files/tools/default-onlyoffice-ssl.sh b/build/install/deb/Files/tools/default-onlyoffice-ssl.sh
new file mode 100644
index 000000000..9078d91f1
--- /dev/null
+++ b/build/install/deb/Files/tools/default-onlyoffice-ssl.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+if [ ! -f /var/www/onlyoffice/Data/certs/dhparam.pem ]; then
+ sudo openssl dhparam -out dhparam.pem 2048
+
+ mv dhparam.pem /var/www/onlyoffice/Data/certs/dhparam.pem;
+fi
+
+DOCKER_ONLYOFFICE_SUBNET=$(ip -o -f inet addr show | awk '/scope global/ {print $4}');
+
+cp /etc/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template default-onlyoffice-ssl.conf;
+
+SSL_CERTIFICATE_PATH="/var/www/onlyoffice/Data/certs/onlyoffice.crt"
+SSL_KEY_PATH="/var/www/onlyoffice/Data/certs/onlyoffice.key"
+ONLYOFFICE_SERVICES_DIR="/var/www/onlyoffice/Services"
+
+sed "s,{{SSL_CERTIFICATE_PATH}},${SSL_CERTIFICATE_PATH}," -i default-onlyoffice-ssl.conf;
+sed "s,{{SSL_KEY_PATH}},${SSL_KEY_PATH}," -i default-onlyoffice-ssl.conf;
+sed 's,{{SSL_DHPARAM_PATH}},/var/www/onlyoffice/Data/certs/dhparam.pem,' -i default-onlyoffice-ssl.conf;
+sed 's,{{SSL_VERIFY_CLIENT}},off,' -i default-onlyoffice-ssl.conf;
+sed '/{{CA_CERTIFICATES_PATH}}/d' -i default-onlyoffice-ssl.conf;
+sed 's/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/63072000/' -i default-onlyoffice-ssl.conf;
+sed 's,{{DOCKER_ONLYOFFICE_SUBNET}},'"${DOCKER_ONLYOFFICE_SUBNET}"',' -i default-onlyoffice-ssl.conf;
+sed 's/{{ONLYOFFICE_NIGNX_KEEPLIVE}}/64/g' -i default-onlyoffice-ssl.conf;
+
+SSL_OCSP_CERTIFICATE_PATH="/var/www/onlyoffice/Data/certs/stapling.trusted.crt"
+
+# if dhparam path is valid, add to the config, otherwise remove the option
+if [ -r "${SSL_OCSP_CERTIFICATE_PATH}" ]; then
+ sed 's,{{SSL_OCSP_CERTIFICATE_PATH}},'"${SSL_OCSP_CERTIFICATE_PATH}"',' -i default-onlyoffice-ssl.conf;
+else
+ sed '/ssl_stapling/d' -i default-onlyoffice-ssl.conf;
+ sed '/ssl_stapling_verify/d' -i default-onlyoffice-ssl.conf;
+ sed '/ssl_trusted_certificate/d' -i default-onlyoffice-ssl.conf;
+ sed '/resolver/d' -i default-onlyoffice-ssl.conf;
+ sed '/resolver_timeout/d' -i default-onlyoffice-ssl.conf;
+fi
+
+# sed '/certificate/s/\(value\s*=\s*\"\).*\"/\1${SSL_CERTIFICATE_PATH}"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config
+# sed '/certificatePrivateKey/s/\(value\s*=\s*\"\).*\"/\1${SSL_KEY_PATH}"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config;
+# sed '/startTls/s/\(value\s*=\s*\"\).*\"/\1optional"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config;
+
+sed '/mail\.default-api-scheme/s/\(value\s*=\s*\"\).*\"/\1https\"/' -i /var/www/onlyoffice/Services/MailAggregator/ASC.Mail.Aggregator.CollectionService.exe.config;
+
+mv default-onlyoffice-ssl.conf /etc/nginx/sites-enabled/onlyoffice
+
+service onlyofficeMailAggregator restart
+# service onlyofficeJabber restart
+service nginx reload
diff --git a/build/install/deb/Files/tools/default-onlyoffice.sh b/build/install/deb/Files/tools/default-onlyoffice.sh
new file mode 100644
index 000000000..e09d6b212
--- /dev/null
+++ b/build/install/deb/Files/tools/default-onlyoffice.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+cp /etc/nginx/includes/onlyoffice-communityserver-common.conf.template default-onlyoffice.conf;
+
+sed 's/{{ONLYOFFICE_NIGNX_KEEPLIVE}}/64/g' -i default-onlyoffice.conf;
+sed '/mail\.default-api-scheme/s/\(value\s*=\s*\"\).*\"/\1http\"/' -i /var/www/onlyoffice/Services/MailAggregator/ASC.Mail.Aggregator.CollectionService.exe.config;
+
+mv default-onlyoffice.conf /etc/nginx/sites-enabled/onlyoffice
+
+service onlyofficeMailAggregator restart
+service nginx reload
+
diff --git a/build/install/deb/Files/tools/letsencrypt.sh b/build/install/deb/Files/tools/letsencrypt.sh
new file mode 100644
index 000000000..ef6d0f3a9
--- /dev/null
+++ b/build/install/deb/Files/tools/letsencrypt.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+_domains="";
+
+for arg; do
+ _domains="$_domains -d $arg";
+done
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+certbot certonly --expand --webroot -w /var/www/onlyoffice/Data/certs --noninteractive --agree-tos --email support@$1 $_domains;
+
+cp /etc/letsencrypt/live/$1/fullchain.pem /var/www/onlyoffice/Data/certs/onlyoffice.crt
+cp /etc/letsencrypt/live/$1/privkey.pem /var/www/onlyoffice/Data/certs/onlyoffice.key
+cp /etc/letsencrypt/live/$1/chain.pem /var/www/onlyoffice/Data/certs/stapling.trusted.crt
+
+cat > /etc/cron.d/letsencrypt <> /var/log/le-renew.log
+@weekly root cp /etc/letsencrypt/live/$1/fullchain.pem /var/www/onlyoffice/Data/certs/onlyoffice.crt
+@weekly root cp /etc/letsencrypt/live/$1/privkey.pem /var/www/onlyoffice/Data/certs/onlyoffice.key
+@weekly root cp /etc/letsencrypt/live/$1/chain.pem /var/www/onlyoffice/Data/certs/stapling.trusted.crt
+@weekly root nginx reload
+END
+
+source $DIR/default-onlyoffice-ssl.sh
diff --git a/build/install/deb/debian/onlyoffice-communityserver.install b/build/install/deb/debian/onlyoffice-communityserver.install
index 2aa4b71b7..8601685ae 100644
--- a/build/install/deb/debian/onlyoffice-communityserver.install
+++ b/build/install/deb/debian/onlyoffice-communityserver.install
@@ -5,5 +5,6 @@ Files/god/* etc/god/
Files/Services/* var/www/onlyoffice/Services/
Files/WebStudio/* var/www/onlyoffice/WebStudio/
Files/sql/* var/www/onlyoffice/Sql/
+Files/tools/* var/www/onlyoffice/Tools/
Files/licenses/* usr/share/doc/onlyoffice-communityserver/licenses/
Files/ApiSystem/* var/www/onlyoffice/ApiSystem/
diff --git a/build/install/deb/debian/postinst b/build/install/deb/debian/postinst
index cfba7015f..982774e35 100644
--- a/build/install/deb/debian/postinst
+++ b/build/install/deb/debian/postinst
@@ -45,53 +45,69 @@ install_db(){
sed "s/#max_connections.*/max_connections = 1000/" -i /etc/mysql/my.cnf || true # ignore errors
- if [ -e /etc/mysql/mysql.conf.d/mysqld.cnf ]; then
- if ! grep -q "^sql_mode" /etc/mysql/mysql.conf.d/mysqld.cnf; then
- sed "/\[mysqld\]/a sql_mode = 'NO_ENGINE_SUBSTITUTION'" -i /etc/mysql/mysql.conf.d/mysqld.cnf # disable new STRICT mode in mysql 5.7
+ CNF_PATH="/etc/mysql/mysql.conf.d/mysqld.cnf";
+ CNF_SERVICE_PATH="/lib/systemd/system/mysql.service";
+
+ if mysql -V | grep -q "MariaDB"; then
+ CNF_PATH="/etc/mysql/mariadb.conf.d/50-server.cnf";
+ CNF_SERVICE_PATH="/lib/systemd/system/mariadb.service";
+ fi
+
+
+ if [ -e ${CNF_PATH} ]; then
+ if ! grep -q "^sql_mode" ${CNF_PATH}; then
+ sed "/\[mysqld\]/a sql_mode = 'NO_ENGINE_SUBSTITUTION'" -i ${CNF_PATH} # disable new STRICT mode in mysql 5.7
else
- sed "s/sql_mode.*/sql_mode = 'NO_ENGINE_SUBSTITUTION'/" -i /etc/mysql/mysql.conf.d/mysqld.cnf || true # ignore errors
+ sed "s/sql_mode.*/sql_mode = 'NO_ENGINE_SUBSTITUTION'/" -i ${CNF_PATH} || true # ignore errors
fi
- if ! grep -q "^max_connections" /etc/mysql/mysql.conf.d/mysqld.cnf; then
- sed '/\[mysqld\]/a max_connections = 1000' -i /etc/mysql/mysql.conf.d/mysqld.cnf
+ if ! grep -q "^max_connections" ${CNF_PATH}; then
+ sed '/\[mysqld\]/a max_connections = 1000' -i ${CNF_PATH}
else
- sed "s/max_connections.*/max_connections = 1000/" -i /etc/mysql/mysql.conf.d/mysqld.cnf || true # ignore errors
+ sed "s/max_connections.*/max_connections = 1000/" -i ${CNF_PATH} || true # ignore errors
fi
- if ! grep -q "^max_allowed_packet" /etc/mysql/mysql.conf.d/mysqld.cnf; then
- sed '/\[mysqld\]/a max_allowed_packet = 1048576000' -i /etc/mysql/mysql.conf.d/mysqld.cnf
+ if ! grep -q "^max_allowed_packet" ${CNF_PATH}; then
+ sed '/\[mysqld\]/a max_allowed_packet = 1048576000' -i ${CNF_PATH}
else
- sed "s/max_allowed_packet.*/max_allowed_packet = 1048576000/" -i /etc/mysql/mysql.conf.d/mysqld.cnf || true # ignore errors
+ sed "s/max_allowed_packet.*/max_allowed_packet = 1048576000/" -i ${CNF_PATH} || true # ignore errors
fi
- if [ -e /lib/systemd/system/mysql.service ]; then
- if ! grep -q "^LimitNOFILE" /lib/systemd/system/mysql.service; then
- sed '/\[Service\]/a LimitNOFILE = infinity' -i /lib/systemd/system/mysql.service
+ if [ -e ${CNF_SERVICE_PATH} ]; then
+ if ! grep -q "^LimitNOFILE" ${CNF_SERVICE_PATH}; then
+ sed '/\[Service\]/a LimitNOFILE = infinity' -i ${CNF_SERVICE_PATH}
else
- sed "s/LimitNOFILE.*/LimitNOFILE = infinity/" -i /lib/systemd/system/mysql.service || true # ignore errors
+ sed "s/LimitNOFILE.*/LimitNOFILE = infinity/" -i ${CNF_SERVICE_PATH} || true # ignore errors
fi
- if ! grep -q "^LimitMEMLOCK" /lib/systemd/system/mysql.service; then
- sed '/\[Service\]/a LimitMEMLOCK = infinity' -i /lib/systemd/system/mysql.service
+ if ! grep -q "^LimitMEMLOCK" ${CNF_SERVICE_PATH}; then
+ sed '/\[Service\]/a LimitMEMLOCK = infinity' -i ${CNF_SERVICE_PATH}
else
- sed "s/LimitMEMLOCK.*/LimitMEMLOCK = infinity/" -i /lib/systemd/system/mysql.service || true # ignore errors
+ sed "s/LimitMEMLOCK.*/LimitMEMLOCK = infinity/" -i ${CNF_SERVICE_PATH} || true # ignore errors
fi
systemctl daemon-reload
fi
+ fi
- service mysql restart
-
- if [ -z "$DB_PWD" ] && [ "$DB_USER" = "root" ]; then
- # allow MySql.Data.dll connect via mysql_native_password with root and empty password
- $MYSQL -D "mysql" -e "update user set plugin='mysql_native_password' where user='root';"
- fi
+ $MYSQL -e ";" >/dev/null 2>&1 || ( service mysql start >/dev/null 2>&1 && $MYSQL -e ";" >/dev/null )
+ if [ "${DB_USER}" = "root" ]; then
+ # allow MySql.Data.dll connect via mysql_native_password with root and empty password
+ $MYSQL -D "mysql" -e "UPDATE user SET plugin='mysql_native_password' WHERE user='${DB_USER}' and host='localhost';"
fi
- # test mysql connection
- $MYSQL -e ";" &>/dev/null || ( service mysql start &>/dev/null && $MYSQL -e ";" >/dev/null )
+ service mysql restart
+
+ # hack for Debian 9 (mariadb)
+ if [ -n "${DB_PWD}" ] && [ "${DB_USER}" = "root" ] && mysql -e ";" >/dev/null 2>&1; then
+
+mysql <= 1.1.0
+ ssl_session_cache shared:SSL:10m;
+ ssl_session_tickets off; # Requires nginx >= 1.5.9
+
+ add_header Strict-Transport-Security "max-age={{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}; includeSubDomains; preload" always;
+# add_header X-Frame-Options DENY;
+ add_header X-Content-Type-Options nosniff;
+ add_header Access-Control-Allow-Origin *;
+
+ ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
+ ## Replace with your ssl_trusted_certificate. For more info see:
+ ## - https://medium.com/devops-programming/4445f4862461
+ ## - https://www.ruby-forum.com/topic/4419319
+ ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
+ ssl_stapling on;
+ ssl_stapling_verify on;
+ ssl_trusted_certificate {{SSL_OCSP_CERTIFICATE_PATH}};
+ resolver 8.8.8.8 8.8.4.4 127.0.0.11 valid=300s; # Can change to your DNS resolver if desired
+ resolver_timeout 10s;
+
+ ## [Optional] Generate a stronger DHE parameter:
+ ## cd /etc/ssl/certs
+ ## sudo openssl dhparam -out dhparam.pem 4096
+ ##
+ ssl_dhparam {{SSL_DHPARAM_PATH}};
+
+ include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
+}
+
+
+
diff --git a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf
index 8f2fb70d8..3bf2f1e1b 100644
--- a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf
+++ b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf
@@ -43,6 +43,7 @@ location / {
fastcgi_pass unix:/var/run/onlyoffice/onlyoffice$1.socket;
}
+
location ~* (^\/(?:skins|products|addons).*\.(?:jpg|jpeg|gif|png|svg|ico)$)|(.*bundle/(?!clientscript).*) {
fastcgi_pass fastcgi_backend;
@@ -97,7 +98,7 @@ location /apisystem {
}
location /filesData {
- rewrite /filesData(.*) /$1 break;
- root /;
+ rewrite /filesData/var/www/onlyoffice/Data/Products/Files(.*) /$1 break;
+ root /var/www/onlyoffice/Data/Products/Files;
internal;
}
diff --git a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf.template b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
new file mode 100644
index 000000000..c86174e1c
--- /dev/null
+++ b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-common.conf.template
@@ -0,0 +1,38 @@
+upstream fastcgi_backend_apisystem {
+ server unix:/var/run/onlyoffice/onlyofficeApiSystem.socket;
+ keepalive 32;
+}
+
+upstream fastcgi_backend {
+ server unix:/var/run/onlyoffice/onlyoffice.socket;
+ keepalive {{ONLYOFFICE_NIGNX_KEEPLIVE}};
+}
+
+fastcgi_cache_path /var/cache/nginx/onlyoffice
+ levels=1:2
+ keys_zone=onlyoffice:16m
+ max_size=256m
+ inactive=1d;
+
+map $http_host $this_host {
+ "" $host;
+ default $http_host;
+}
+
+map $http_x_forwarded_proto $the_scheme {
+ default $http_x_forwarded_proto;
+ "" $scheme;
+}
+
+map $http_x_forwarded_host $the_host {
+ default $http_x_forwarded_host;
+ "" $this_host;
+}
+
+server {
+ listen 80;
+
+ add_header Access-Control-Allow-Origin *;
+
+ include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
+}
diff --git a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
new file mode 100644
index 000000000..a61a6b92d
--- /dev/null
+++ b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-nginx.conf.template
@@ -0,0 +1,32 @@
+user nginx;
+worker_processes auto;
+
+error_log /var/log/nginx/error.log warn;
+pid /var/run/nginx.pid;
+
+
+events {
+ worker_connections 1024;
+}
+
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /var/log/nginx/access.log main;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ keepalive_timeout 65;
+
+ #gzip on;
+ include /etc/nginx/sites-enabled/*;
+ include /etc/nginx/conf.d/*.conf;
+}
+
diff --git a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-proxy-to-controlpanel.conf.template b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-proxy-to-controlpanel.conf.template
index 6279a9428..4cf7da5e5 100644
--- a/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-proxy-to-controlpanel.conf.template
+++ b/build/install/rpm/Files/nginx/includes/onlyoffice-communityserver-proxy-to-controlpanel.conf.template
@@ -16,7 +16,7 @@ location /controlpanel {
}
location /sso/ {
- proxy_pass http://{{SERVICE_SSO_AUTH_HOST_ADDR}}:9834;
+ proxy_pass http://{{SERVICE_SSO_AUTH_HOST_ADDR}}:9834;
client_max_body_size 100m;
@@ -30,6 +30,7 @@ location /sso/ {
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-REWRITER-URL $scheme://$http_host;
-
+
proxy_redirect / /;
+
}
diff --git a/build/install/rpm/Files/tools/default-onlyoffice-ssl.sh b/build/install/rpm/Files/tools/default-onlyoffice-ssl.sh
new file mode 100644
index 000000000..9078d91f1
--- /dev/null
+++ b/build/install/rpm/Files/tools/default-onlyoffice-ssl.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+if [ ! -f /var/www/onlyoffice/Data/certs/dhparam.pem ]; then
+ sudo openssl dhparam -out dhparam.pem 2048
+
+ mv dhparam.pem /var/www/onlyoffice/Data/certs/dhparam.pem;
+fi
+
+DOCKER_ONLYOFFICE_SUBNET=$(ip -o -f inet addr show | awk '/scope global/ {print $4}');
+
+cp /etc/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template default-onlyoffice-ssl.conf;
+
+SSL_CERTIFICATE_PATH="/var/www/onlyoffice/Data/certs/onlyoffice.crt"
+SSL_KEY_PATH="/var/www/onlyoffice/Data/certs/onlyoffice.key"
+ONLYOFFICE_SERVICES_DIR="/var/www/onlyoffice/Services"
+
+sed "s,{{SSL_CERTIFICATE_PATH}},${SSL_CERTIFICATE_PATH}," -i default-onlyoffice-ssl.conf;
+sed "s,{{SSL_KEY_PATH}},${SSL_KEY_PATH}," -i default-onlyoffice-ssl.conf;
+sed 's,{{SSL_DHPARAM_PATH}},/var/www/onlyoffice/Data/certs/dhparam.pem,' -i default-onlyoffice-ssl.conf;
+sed 's,{{SSL_VERIFY_CLIENT}},off,' -i default-onlyoffice-ssl.conf;
+sed '/{{CA_CERTIFICATES_PATH}}/d' -i default-onlyoffice-ssl.conf;
+sed 's/{{ONLYOFFICE_HTTPS_HSTS_MAXAGE}}/63072000/' -i default-onlyoffice-ssl.conf;
+sed 's,{{DOCKER_ONLYOFFICE_SUBNET}},'"${DOCKER_ONLYOFFICE_SUBNET}"',' -i default-onlyoffice-ssl.conf;
+sed 's/{{ONLYOFFICE_NIGNX_KEEPLIVE}}/64/g' -i default-onlyoffice-ssl.conf;
+
+SSL_OCSP_CERTIFICATE_PATH="/var/www/onlyoffice/Data/certs/stapling.trusted.crt"
+
+# if dhparam path is valid, add to the config, otherwise remove the option
+if [ -r "${SSL_OCSP_CERTIFICATE_PATH}" ]; then
+ sed 's,{{SSL_OCSP_CERTIFICATE_PATH}},'"${SSL_OCSP_CERTIFICATE_PATH}"',' -i default-onlyoffice-ssl.conf;
+else
+ sed '/ssl_stapling/d' -i default-onlyoffice-ssl.conf;
+ sed '/ssl_stapling_verify/d' -i default-onlyoffice-ssl.conf;
+ sed '/ssl_trusted_certificate/d' -i default-onlyoffice-ssl.conf;
+ sed '/resolver/d' -i default-onlyoffice-ssl.conf;
+ sed '/resolver_timeout/d' -i default-onlyoffice-ssl.conf;
+fi
+
+# sed '/certificate/s/\(value\s*=\s*\"\).*\"/\1${SSL_CERTIFICATE_PATH}"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config
+# sed '/certificatePrivateKey/s/\(value\s*=\s*\"\).*\"/\1${SSL_KEY_PATH}"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config;
+# sed '/startTls/s/\(value\s*=\s*\"\).*\"/\1optional"\"/' -i ${ONLYOFFICE_SERVICES_DIR}/TeamLabSvc/TeamLabSvc.exe.Config;
+
+sed '/mail\.default-api-scheme/s/\(value\s*=\s*\"\).*\"/\1https\"/' -i /var/www/onlyoffice/Services/MailAggregator/ASC.Mail.Aggregator.CollectionService.exe.config;
+
+mv default-onlyoffice-ssl.conf /etc/nginx/sites-enabled/onlyoffice
+
+service onlyofficeMailAggregator restart
+# service onlyofficeJabber restart
+service nginx reload
diff --git a/build/install/rpm/Files/tools/default-onlyoffice.sh b/build/install/rpm/Files/tools/default-onlyoffice.sh
new file mode 100644
index 000000000..e09d6b212
--- /dev/null
+++ b/build/install/rpm/Files/tools/default-onlyoffice.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+cp /etc/nginx/includes/onlyoffice-communityserver-common.conf.template default-onlyoffice.conf;
+
+sed 's/{{ONLYOFFICE_NIGNX_KEEPLIVE}}/64/g' -i default-onlyoffice.conf;
+sed '/mail\.default-api-scheme/s/\(value\s*=\s*\"\).*\"/\1http\"/' -i /var/www/onlyoffice/Services/MailAggregator/ASC.Mail.Aggregator.CollectionService.exe.config;
+
+mv default-onlyoffice.conf /etc/nginx/sites-enabled/onlyoffice
+
+service onlyofficeMailAggregator restart
+service nginx reload
+
diff --git a/build/install/rpm/Files/tools/letsencrypt.sh b/build/install/rpm/Files/tools/letsencrypt.sh
new file mode 100644
index 000000000..ef6d0f3a9
--- /dev/null
+++ b/build/install/rpm/Files/tools/letsencrypt.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+_domains="";
+
+for arg; do
+ _domains="$_domains -d $arg";
+done
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+certbot certonly --expand --webroot -w /var/www/onlyoffice/Data/certs --noninteractive --agree-tos --email support@$1 $_domains;
+
+cp /etc/letsencrypt/live/$1/fullchain.pem /var/www/onlyoffice/Data/certs/onlyoffice.crt
+cp /etc/letsencrypt/live/$1/privkey.pem /var/www/onlyoffice/Data/certs/onlyoffice.key
+cp /etc/letsencrypt/live/$1/chain.pem /var/www/onlyoffice/Data/certs/stapling.trusted.crt
+
+cat > /etc/cron.d/letsencrypt <> /var/log/le-renew.log
+@weekly root cp /etc/letsencrypt/live/$1/fullchain.pem /var/www/onlyoffice/Data/certs/onlyoffice.crt
+@weekly root cp /etc/letsencrypt/live/$1/privkey.pem /var/www/onlyoffice/Data/certs/onlyoffice.key
+@weekly root cp /etc/letsencrypt/live/$1/chain.pem /var/www/onlyoffice/Data/certs/stapling.trusted.crt
+@weekly root nginx reload
+END
+
+source $DIR/default-onlyoffice-ssl.sh
diff --git a/build/install/rpm/onlyoffice.spec b/build/install/rpm/onlyoffice.spec
index 834968241..920755642 100644
--- a/build/install/rpm/onlyoffice.spec
+++ b/build/install/rpm/onlyoffice.spec
@@ -24,9 +24,11 @@ rm -rf "$RPM_BUILD_ROOT"
%install
#install onlyoffice files
mkdir -p "$RPM_BUILD_ROOT/var/www/onlyoffice/"
+mkdir -p "$RPM_BUILD_ROOT/var/www/onlyoffice/Tools/"
mkdir -p "$RPM_BUILD_ROOT/usr/bin/"
cp -r ../../Files/bin/*.sh "$RPM_BUILD_ROOT/usr/bin/"
cp -r ../../Files/onlyoffice/. "$RPM_BUILD_ROOT/var/www/onlyoffice/"
+cp -r ../../Files/tools/. "$RPM_BUILD_ROOT/var/www/onlyoffice/Tools/"
mkdir -p "$RPM_BUILD_ROOT/var/log/onlyoffice/"
#install init scripts
@@ -80,10 +82,13 @@ rm -rf "$RPM_BUILD_ROOT"
%config %attr(-, root, root) /usr/lib/systemd/system/*.service
%config %attr(-, root, root) /etc/nginx/conf.d/onlyoffice.conf
%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-common.conf
+%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-common.conf.template
+%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-common-init.conf.template
+%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-common-ssl.conf.template
+%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-nginx.conf.template
%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-services.conf
%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-letsencrypt.conf
%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-proxy-to-controlpanel.conf.template
-%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-ssl.template
%config %attr(-, root, root) /etc/nginx/includes/onlyoffice-communityserver-proxy-to-documentserver.conf.template
%config %attr(-, root, root) /etc/hyperfastcgi/onlyoffice
%config %attr(-, root, root) /etc/hyperfastcgi/onlyofficeApiSystem
diff --git a/common/ASC.Data.Backup/Tasks/Modules/CrmModuleSpecifics.cs b/common/ASC.Data.Backup/Tasks/Modules/CrmModuleSpecifics.cs
index 53b67aea6..a75365aa5 100644
--- a/common/ASC.Data.Backup/Tasks/Modules/CrmModuleSpecifics.cs
+++ b/common/ASC.Data.Backup/Tasks/Modules/CrmModuleSpecifics.cs
@@ -329,6 +329,8 @@ public override IEnumerable TableRelations
protected override bool TryPrepareValue(IDbConnection connection, ColumnMapper columnMapper, TableInfo table, string columnName, ref object value)
{
+ if (value == null) return false;
+
if (table.Name == "crm_invoice" && columnName == "json_data")
{
var data = JObject.Parse((string)value);
diff --git a/module/ASC.Api/ASC.Api.Mail/MailApi.MailService.cs b/module/ASC.Api/ASC.Api.Mail/MailApi.MailService.cs
index d87424b0f..627dab763 100644
--- a/module/ASC.Api/ASC.Api.Mail/MailApi.MailService.cs
+++ b/module/ASC.Api/ASC.Api.Mail/MailApi.MailService.cs
@@ -54,15 +54,15 @@ public object ConnectMailServer(string ip, string user, string password)
if (string.IsNullOrEmpty(ip))
throw new ArgumentException("ip");
- if (!PingHost(ip, 3306))
- throw new Exception(string.Format(Resource.MailServicePingErrorMsg, ip));
-
if (string.IsNullOrEmpty(user))
throw new ArgumentException("user");
if (string.IsNullOrEmpty(password))
throw new ArgumentException("password");
+ if (!PingHost(ip, 3306))
+ throw new Exception(string.Format(Resource.MailServicePingErrorMsg, ip));
+
var connectionString = string.Format(MailServiceHelper.ConnectionStringFormat, ip, MailServiceHelper.DefaultDatabase, user, password);
var data = GetAuthData(connectionString, ip);
@@ -142,27 +142,20 @@ public object ConnectAndSaveMailServerInfo(string host, string user, string pass
if (string.IsNullOrEmpty(host))
throw new ArgumentException("host");
- var ipList = new DnsLookup().GetDomainIPs(host).ToList();
+ if (string.IsNullOrEmpty(user))
+ throw new ArgumentException("user");
- if (!ipList.Any())
- throw new Exception("could not get host ip");
+ if (string.IsNullOrEmpty(password))
+ throw new ArgumentException("password");
- var firstIpItem = ipList.FirstOrDefault();
+ var ip = GetHostIp(host);
- if (firstIpItem == null)
+ if (string.IsNullOrEmpty(ip))
throw new Exception("could not get host ip");
- var ip = firstIpItem.ToString();
-
if (!PingHost(ip, 3306))
throw new Exception(string.Format(Resource.MailServicePingErrorMsg, ip));
- if (string.IsNullOrEmpty(user))
- throw new ArgumentException("user");
-
- if (string.IsNullOrEmpty(password))
- throw new ArgumentException("password");
-
var connectionString = string.Format(MailServiceHelper.ConnectionStringFormat, ip, MailServiceHelper.DefaultDatabase, user, password);
var data = GetAuthData(connectionString, ip);
@@ -187,6 +180,60 @@ public object ConnectAndSaveMailServerInfo(string host, string user, string pass
}
}
+ /// false
+ [Create("mailservice/connectandsavepartitional")]
+ public object ConnectAndSavePartitionalMailServerInfo(string mailHost, string mysqlHost, string mysqlUser, string mysqlPassword)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(mailHost))
+ throw new ArgumentException("mailHost");
+
+ if (string.IsNullOrEmpty(mysqlHost))
+ throw new ArgumentException("mysqlHost");
+
+ if (string.IsNullOrEmpty(mysqlUser))
+ throw new ArgumentException("mysqlUser");
+
+ if (string.IsNullOrEmpty(mysqlPassword))
+ throw new ArgumentException("mysqlPassword");
+
+ var mailIp = GetHostIp(mailHost);
+
+ if (string.IsNullOrEmpty(mailIp))
+ throw new Exception("could not get mailHost ip");
+
+ var mysqlIp = GetHostIp(mysqlHost);
+
+ if (string.IsNullOrEmpty(mysqlIp))
+ throw new Exception("could not get mysqlHost ip");
+
+ if (!PingHost(mysqlIp, 3306))
+ throw new Exception(string.Format(Resource.MailServicePingErrorMsg, mysqlIp));
+
+ var connectionString = string.Format(MailServiceHelper.ConnectionStringFormat, mysqlIp, MailServiceHelper.DefaultDatabase, mysqlUser, mysqlPassword);
+
+ var data = GetAuthData(connectionString, mailIp);
+
+ Save(connectionString, mailIp, data[0], data[1]);
+
+ return new
+ {
+ status = "success",
+ message = Resource.MailServiceSaveSuccessMsg
+ };
+ }
+ catch (Exception exception)
+ {
+ Logger.Error(exception.Message, exception);
+
+ return new
+ {
+ status = "error",
+ message = exception.Message.HtmlEncode()
+ };
+ }
+ }
private static bool PingHost(string host, int port)
{
@@ -201,6 +248,19 @@ private static bool PingHost(string host, int port)
}
}
+ private static string GetHostIp(string host)
+ {
+ try
+ {
+ var ip = new DnsLookup().GetDomainIPs(host).FirstOrDefault();
+ return ip == null ? null : ip.ToString();
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
private static string[] GetAuthData(string connectionString, string ip)
{
var data = MailServiceHelper.GetDataFromExternalDatabase(MailServiceHelper.MailServiceDbId, connectionString, ip);
diff --git a/module/ASC.Api/ASC.Specific/ASC.Specific.csproj b/module/ASC.Api/ASC.Specific/ASC.Specific.csproj
index f7d66b435..d87ea9fc2 100644
--- a/module/ASC.Api/ASC.Specific/ASC.Specific.csproj
+++ b/module/ASC.Api/ASC.Specific/ASC.Specific.csproj
@@ -91,6 +91,10 @@
+
+ {e588e818-f163-470c-802c-3a6e45b36080}
+ ASC.ActiveDirectory
+
{76de7717-3d4b-4a5b-b740-15b8913df0cb}
ASC.Common
@@ -105,6 +109,10 @@
{2FF2177F-2D1A-4396-84EB-51F14FD99385}
ASC.IPSecurity
+
+ {ef3ae6b9-4503-42a3-88bc-c622e178a59e}
+ ASC.SingleSignOn
+
{02c40a64-fe22-41d0-9037-69f0d6f787a9}
ASC.Web.Core
diff --git a/module/ASC.Api/ASC.Specific/CapabilitiesApi/CapabilitiesEntryPoint.cs b/module/ASC.Api/ASC.Specific/CapabilitiesApi/CapabilitiesEntryPoint.cs
index 6d5ed7c1d..2061647be 100644
--- a/module/ASC.Api/ASC.Specific/CapabilitiesApi/CapabilitiesEntryPoint.cs
+++ b/module/ASC.Api/ASC.Specific/CapabilitiesApi/CapabilitiesEntryPoint.cs
@@ -27,10 +27,13 @@
using System;
using System.Configuration;
using System.Web;
+using ASC.ActiveDirectory;
using ASC.Api.Attributes;
using ASC.Api.Impl;
using ASC.Api.Interfaces;
using ASC.Core;
+using ASC.Core.Common.Settings;
+using ASC.SingleSignOn.Common;
using ASC.Web.Studio.Core;
using ASC.Web.Studio.Utility;
using log4net;
@@ -70,21 +73,38 @@ public CapabilitiesData GetPortalCapabilities()
{
try
{
- var ldapEnabled = false;
+ bool ldapEnabled;
- if (SetupInfo.IsVisibleSettings(ManagementType.LdapSettings.ToString()))
+ if (!SetupInfo.IsVisibleSettings(ManagementType.LdapSettings.ToString()) ||
+ (CoreContext.Configuration.Standalone &&
+ !CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Ldap))
{
- ldapEnabled = !CoreContext.Configuration.Standalone ||
- CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Ldap;
+ ldapEnabled = false;
+ }
+ else
+ {
+ var settings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+
+ ldapEnabled = settings.EnableLdapAuthentication;
}
- var ssoUrl = string.Empty;
+ string ssoUrl;
- if (SetupInfo.IsVisibleSettings(ManagementType.SingleSignOnSettings.ToString()))
+ if (!SetupInfo.IsVisibleSettings(ManagementType.SingleSignOnSettings.ToString()) ||
+ (CoreContext.Configuration.Standalone &&
+ !CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Sso))
{
- var ssoEnabled = !CoreContext.Configuration.Standalone || CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Sso;
+ ssoUrl = string.Empty;
+ }
+ else
+ {
+ var settings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- if (ssoEnabled)
+ if (!settings.EnableSso)
+ {
+ ssoUrl = string.Empty;
+ }
+ else
{
var uri = HttpContext.Current.Request.GetUrlRewriter();
diff --git a/module/ASC.Files.Thirdparty/GoogleDrive/GoogleDriveStorage.cs b/module/ASC.Files.Thirdparty/GoogleDrive/GoogleDriveStorage.cs
index 7975a6beb..275c10d78 100644
--- a/module/ASC.Files.Thirdparty/GoogleDrive/GoogleDriveStorage.cs
+++ b/module/ASC.Files.Thirdparty/GoogleDrive/GoogleDriveStorage.cs
@@ -204,25 +204,22 @@ public Stream DownloadStream(DriveFile file)
request.Method = "GET";
request.Headers.Add("Authorization", "Bearer " + AccessToken);
- using (var response = (HttpWebResponse)request.GetResponse())
+ var response = (HttpWebResponse)request.GetResponse();
+
+ if (file.Size.HasValue && file.Size > 0)
{
- if (file.Size.HasValue && file.Size > 0)
- {
- return new ResponseStream(response.GetResponseStream(), file.Size.Value);
- }
+ return new ResponseStream(response.GetResponseStream(), file.Size.Value);
+ }
- var tempBuffer = new FileStream(Path.GetTempFileName(), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read, 8096, FileOptions.DeleteOnClose);
- using (var str = response.GetResponseStream())
- {
- if (str != null)
- {
- str.CopyTo(tempBuffer);
- tempBuffer.Flush();
- tempBuffer.Seek(0, SeekOrigin.Begin);
- }
- }
- return tempBuffer;
+ var tempBuffer = new FileStream(Path.GetTempFileName(), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read, 8096, FileOptions.DeleteOnClose);
+ var str = response.GetResponseStream();
+ if (str != null)
+ {
+ str.CopyTo(tempBuffer);
+ tempBuffer.Flush();
+ tempBuffer.Seek(0, SeekOrigin.Begin);
}
+ return tempBuffer;
}
public DriveFile InsertEntry(Stream fileStream, string title, string parentId, bool folder = false)
diff --git a/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/ASC.Mail.Aggregator.CollectionService.csproj b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/ASC.Mail.Aggregator.CollectionService.csproj
index 1dc4d3aa5..fc3f7210d 100644
--- a/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/ASC.Mail.Aggregator.CollectionService.csproj
+++ b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/ASC.Mail.Aggregator.CollectionService.csproj
@@ -166,6 +166,7 @@
+
diff --git a/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/AggregatorService.cs b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/AggregatorService.cs
index d5402f071..11d789767 100644
--- a/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/AggregatorService.cs
+++ b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/AggregatorService.cs
@@ -38,11 +38,11 @@
using System.Threading.Tasks;
using ASC.Core;
using ASC.Mail.Aggregator.CollectionService.Queue;
+using ASC.Mail.Aggregator.CollectionService.Queue.Data;
using ASC.Mail.Aggregator.Common;
using ASC.Mail.Aggregator.Common.Clients;
using ASC.Mail.Aggregator.Common.Extension;
using ASC.Mail.Aggregator.Common.Logging;
-using DotNetOpenAuth.Messaging;
using MailKit.Security;
using ASC.Mail.Aggregator.Common.DataStorage;
using ASC.Mail.Aggregator.Common.Utils;
@@ -52,7 +52,6 @@
using MailKit.Net.Pop3;
using MimeKit;
using MySql.Data.MySqlClient;
-using TimeoutException = System.TimeoutException;
namespace ASC.Mail.Aggregator.CollectionService
{
@@ -307,7 +306,7 @@ private void workTimer_Elapsed(object state)
while (tasks.Any())
{
// Identify the first task that completes.
- var indexTask = Task.WaitAny(tasks.ToArray(), (int)_tsTaskStateCheckInterval.TotalMilliseconds, cancelToken);
+ var indexTask = Task.WaitAny(tasks.Select(t => t.Task).ToArray(), (int)_tsTaskStateCheckInterval.TotalMilliseconds, cancelToken);
if (indexTask > -1)
{
// ***Remove the selected task from the list so that you don't
@@ -323,20 +322,20 @@ private void workTimer_Elapsed(object state)
tasks.Select(
t =>
string.Format("Id: {0} Status: {1}, MailboxId: {2} Address: '{3}'",
- t.Id, t.Status, t.Result.MailBoxId, t.Result.EMail))));
+ t.Task.Id, t.Task.Status, t.Mailbox.MailBoxId, t.Mailbox.EMail))));
}
var tasks2Free =
tasks.Where(
t =>
- t.Status == TaskStatus.Canceled || t.Status == TaskStatus.Faulted ||
- t.Status == TaskStatus.RanToCompletion).ToList();
+ t.Task.Status == TaskStatus.Canceled || t.Task.Status == TaskStatus.Faulted ||
+ t.Task.Status == TaskStatus.RanToCompletion).ToList();
if (tasks2Free.Any())
{
_log.Info("Need free next tasks = {0}: ({1})", tasks2Free.Count,
string.Join(",",
- tasks2Free.Select(t => t.Id.ToString(CultureInfo.InvariantCulture))));
+ tasks2Free.Select(t => t.Task.Id.ToString(CultureInfo.InvariantCulture))));
tasks2Free.ForEach(task => FreeTask(task, tasks));
}
@@ -350,7 +349,7 @@ private void workTimer_Elapsed(object state)
tasks.AddRange(newTasks);
_log.Info("Total tasks count = {0} ({1}).", tasks.Count,
- string.Join(",", tasks.Select(t => t.Id)));
+ string.Join(",", tasks.Select(t => t.Task.Id)));
}
_log.Info("All mailboxes were processed. Go back to timer.");
@@ -428,13 +427,13 @@ private void NotifySignalrIfNeed(MailBox mailbox, ILogger log)
}
}
- private List> CreateTasks(int needCount, CancellationToken cancelToken)
+ private List CreateTasks(int needCount, CancellationToken cancelToken)
{
_log.Info("CreateTasks(need {0} tasks).", needCount);
var mailboxes = _queueManager.GetLockedMailboxes(needCount);
- var tasks = new List>();
+ var tasks = new List();
foreach (var mailbox in mailboxes)
{
@@ -458,7 +457,7 @@ private List> CreateTasks(int needCount, CancellationToken cancelT
var task = _taskFactory.StartNew(() => ProcessMailbox(client, _tasksConfig),
commonCancelToken);
- tasks.Add(task);
+ tasks.Add(new TaskData(mailbox, task));
}
if (tasks.Any())
@@ -502,7 +501,7 @@ private MailClient CreateMailClient(MailBox mailbox, ILogger log, CancellationTo
client.LoginImapPop();
}
- catch (TimeoutException exTimeout)
+ catch (System.TimeoutException exTimeout)
{
log.Warn(
"[TIMEOUT] CreateTasks->client.LoginImapPop(Tenant = {0}, MailboxId = {1}, Address = '{2}') Exception: {3}",
@@ -604,7 +603,7 @@ private void CloseMailClient(MailClient client, MailBox mailbox, ILogger log)
}
}
- private MailBox ProcessMailbox(MailClient client, TasksConfig tasksConfig)
+ private void ProcessMailbox(MailClient client, TasksConfig tasksConfig)
{
var mailbox = client.Account;
@@ -698,8 +697,6 @@ private MailBox ProcessMailbox(MailClient client, TasksConfig tasksConfig)
}
taskLogger.Info("Mailbox '{0}' has been processed.", mailbox.EMail);
-
- return mailbox;
}
private void ClientOnAuthenticated(object sender, MailClientEventArgs mailClientEventArgs)
@@ -1089,7 +1086,7 @@ public string StoreMailEml(int tenant, string user, string streamId, MimeMessage
return string.Empty;
}
- private bool TryStoreMailData(MailMessage message, MailBox mailbox, ILogger log)
+ private static bool TryStoreMailData(MailMessage message, MailBox mailbox, ILogger log)
{
var manager = new MailBoxManager(log);
@@ -1129,18 +1126,25 @@ private bool TryStoreMailData(MailMessage message, MailBox mailbox, ILogger log)
return true;
}
- private void FreeTask(Task task, ICollection> tasks)
+ private void FreeTask(TaskData taskData, ICollection tasks)
{
- _log.Debug("End Task {0} with status = '{1}'.", task.Id, task.Status);
+ try
+ {
+ _log.Debug("End Task {0} with status = '{1}'.", taskData.Task.Id, taskData.Task.Status);
- if (!tasks.Remove(task))
- _log.Error("Task not exists in tasks array.");
+ if (!tasks.Remove(taskData))
+ _log.Error("Task not exists in tasks array.");
- var mailbox = task.Result;
+ var mailbox = taskData.Mailbox;
- ReleaseMailbox(mailbox);
+ ReleaseMailbox(mailbox);
- task.Dispose();
+ taskData.Task.Dispose();
+ }
+ catch (Exception ex)
+ {
+ _log.Error("FreeTask(id:'{0}', email:'{1}'): Exception:\r\n{2}\r\n", taskData.Mailbox.MailBoxId, taskData.Mailbox.EMail, ex.ToString());
+ }
}
private void ReleaseMailbox(MailBox mailbox)
diff --git a/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/Queue/Data/TaskData.cs b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/Queue/Data/TaskData.cs
new file mode 100644
index 000000000..912fed9b7
--- /dev/null
+++ b/module/ASC.Mail.Aggregator/ASC.Mail.Aggregator.CollectionService/Queue/Data/TaskData.cs
@@ -0,0 +1,18 @@
+using System.Threading.Tasks;
+using ASC.Mail.Aggregator.Common;
+
+namespace ASC.Mail.Aggregator.CollectionService.Queue.Data
+{
+ public class TaskData
+ {
+ public TaskData(MailBox mailBox, Task task)
+ {
+ Mailbox = mailBox;
+ Task = task;
+ }
+
+ public MailBox Mailbox { get; private set; }
+
+ public Task Task { get; private set; }
+ }
+}
diff --git a/module/ASC.MessagingSystem/MessageAction.cs b/module/ASC.MessagingSystem/MessageAction.cs
index 627d97050..6105bae56 100644
--- a/module/ASC.MessagingSystem/MessageAction.cs
+++ b/module/ASC.MessagingSystem/MessageAction.cs
@@ -380,7 +380,7 @@ public enum MessageAction
FileLocked = 5006,
FileUnlocked = 5007,
FileUpdatedAccess = 5008,
- FileSendAccessLink = 5036,
+ FileSendAccessLink = 5036, // not used
FileDownloaded = 5009,
FileDownloadedAs = 5010,
diff --git a/web/core/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs b/web/core/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs
index 37d382081..112948ceb 100644
--- a/web/core/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs
+++ b/web/core/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs
@@ -27,6 +27,7 @@
using System;
using System.Configuration;
using System.Drawing;
+using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using ASC.Core;
@@ -85,6 +86,8 @@ public void RestoreDefaultLogo()
{
}
CompanyLogoSize = default(Size);
+
+ TenantLogoManager.RemoveMailLogoDataFromCache();
}
public void SetCompanyLogo(string companyLogoFileName, byte[] data)
@@ -110,6 +113,8 @@ public void SetCompanyLogo(string companyLogoFileName, byte[] data)
_companyLogoFileName = companyLogoFileName;
}
_isDefault = false;
+
+ TenantLogoManager.RemoveMailLogoDataFromCache();
}
public string GetAbsoluteCompanyLogoPath()
@@ -123,6 +128,22 @@ public string GetAbsoluteCompanyLogoPath()
return store.GetUri(_companyLogoFileName ?? "").ToString();
}
+ ///
+ /// Get logo stream or null in case of default logo
+ ///
+ public Stream GetStorageLogoData()
+ {
+ if (_isDefault) return null;
+
+ var storage = StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(CultureInfo.InvariantCulture), "logo");
+
+ if (storage == null) return null;
+
+ var fileName = _companyLogoFileName ?? "";
+
+ return storage.IsFile(fileName) ? storage.GetReadStream(fileName) : null;
+ }
+
public Guid ID
{
get { return new Guid("{5116B892-CCDD-4406-98CD-4F18297C0C0A}"); }
diff --git a/web/core/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs b/web/core/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs
index 28efdedbc..1a7a6bc33 100644
--- a/web/core/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs
+++ b/web/core/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs
@@ -25,9 +25,11 @@
using System;
+using System.IO;
using System.Linq;
using System.Web;
using System.Web.Configuration;
+using ASC.Common.Caching;
using ASC.Core;
using ASC.Core.Common.Settings;
using ASC.Web.Studio.Utility;
@@ -36,6 +38,9 @@ namespace ASC.Web.Core.WhiteLabel
{
public class TenantLogoManager
{
+ private static readonly ICache Cache = AscCache.Default;
+ private const string CacheKey = "letterlogodata";
+
public static bool WhiteLabelEnabled
{
get;
@@ -52,11 +57,11 @@ static TenantLogoManager()
public static string GetFavicon(bool general, bool timeParam)
{
- var faviconPath = "";
+ string faviconPath;
if (WhiteLabelEnabled)
{
- var _tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- faviconPath = _tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.Favicon, general);
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ faviconPath = tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.Favicon, general);
if (timeParam) {
var now = DateTime.Now;
faviconPath = String.Format("{0}?t={1}", faviconPath, now.Ticks);
@@ -74,9 +79,9 @@ public static string GetTopLogo(bool general)//LogoLightSmall
{
if (WhiteLabelEnabled)
{
- var _tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- return _tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.LightSmall, general);
+ return tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.LightSmall, general);
}
return TenantWhiteLabelSettings.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.LightSmall, general);
}
@@ -84,13 +89,13 @@ public static string GetTopLogo(bool general)//LogoLightSmall
public static string GetLogoDark(bool general) {
if (WhiteLabelEnabled)
{
- var _tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- return _tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.Dark, general);
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ return tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.Dark, general);
}
/*** simple scheme ***/
- var _tenantInfoSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- return _tenantInfoSettings.GetAbsoluteCompanyLogoPath();
+ var tenantInfoSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ return tenantInfoSettings.GetAbsoluteCompanyLogoPath();
/***/
}
@@ -98,8 +103,8 @@ public static string GetLogoDocsEditor(bool general)
{
if (WhiteLabelEnabled)
{
- var _tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- return _tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.DocsEditor, general);
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ return tenantWhiteLabelSettings.GetAbsoluteLogoPath(WhiteLabelLogoTypeEnum.DocsEditor, general);
}
return TenantWhiteLabelSettings.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.DocsEditor, general);
}
@@ -108,9 +113,9 @@ public static string GetLogoText()
{
if (WhiteLabelEnabled)
{
- var _tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
- return _tenantWhiteLabelSettings.LogoText != null ? _tenantWhiteLabelSettings.LogoText : TenantWhiteLabelSettings.DefaultLogoText;
+ return tenantWhiteLabelSettings.LogoText ?? TenantWhiteLabelSettings.DefaultLogoText;
}
return TenantWhiteLabelSettings.DefaultLogoText;
}
@@ -118,7 +123,7 @@ public static string GetLogoText()
public static bool IsRetina(HttpRequest request)
{
var isRetina = false;
- if (request != null && request.Cookies != null)
+ if (request != null)
{
var cookie = request.Cookies["is_retina"];
if (cookie != null && !String.IsNullOrEmpty(cookie.Value))
@@ -140,5 +145,38 @@ public static bool WhiteLabelPaid
return CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).WhiteLabel;
}
}
+
+ ///
+ /// Get logo stream or null in case of default logo
+ ///
+ public static Stream GetWhitelabelMailLogo()
+ {
+ if (WhiteLabelEnabled)
+ {
+ var tenantWhiteLabelSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ return tenantWhiteLabelSettings.GetWhitelabelLogoData(WhiteLabelLogoTypeEnum.Dark, true);
+ }
+
+ /*** simple scheme ***/
+ var tenantInfoSettings = SettingsManager.Instance.LoadSettings(TenantProvider.CurrentTenantID);
+ return tenantInfoSettings.GetStorageLogoData();
+ /***/
+ }
+
+
+ public static byte[] GetMailLogoDataFromCache()
+ {
+ return Cache.Get(CacheKey);
+ }
+
+ public static void InsertMailLogoDataToCache(byte[] data)
+ {
+ Cache.Insert(CacheKey, data, DateTime.UtcNow.Add(TimeSpan.FromDays(1)));
+ }
+
+ public static void RemoveMailLogoDataFromCache()
+ {
+ Cache.Remove(CacheKey);
+ }
}
}
\ No newline at end of file
diff --git a/web/core/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs b/web/core/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
index 3e4b7d94d..2fc7580df 100644
--- a/web/core/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
+++ b/web/core/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
@@ -404,6 +404,47 @@ private static string GetPartnerStorageLogoPath(WhiteLabelLogoTypeEnum type, boo
#endregion
+ #region Get Whitelabel Logo Stream
+
+ ///
+ /// Get logo stream or null in case of default whitelabel
+ ///
+ public Stream GetWhitelabelLogoData(WhiteLabelLogoTypeEnum type, bool general)
+ {
+ if (GetIsDefault(type))
+ return GetPartnerStorageLogoData(type, general);
+
+ return GetStorageLogoData(type, general);
+ }
+
+ private Stream GetStorageLogoData(WhiteLabelLogoTypeEnum type, bool general)
+ {
+ var storage = StorageFactory.GetStorage(TenantProvider.CurrentTenantID.ToString(CultureInfo.InvariantCulture), moduleName);
+
+ if (storage == null) return null;
+
+ var fileName = BuildLogoFileName(type, GetExt(type), general);
+
+ return storage.IsFile(fileName) ? storage.GetReadStream(fileName) : null;
+ }
+
+ private Stream GetPartnerStorageLogoData(WhiteLabelLogoTypeEnum type, bool general)
+ {
+ var partnerSettings = SettingsManager.Instance.LoadSettings(Tenant.DEFAULT_TENANT);
+
+ if (partnerSettings.GetIsDefault(type)) return null;
+
+ var partnerStorage = StorageFactory.GetStorage(Tenant.DEFAULT_TENANT.ToString(CultureInfo.InvariantCulture), "static_partnerdata");
+
+ if (partnerStorage == null) return null;
+
+ var fileName = BuildLogoFileName(type, partnerSettings.GetExt(type), general);
+
+ return partnerStorage.IsFile(fileName) ? partnerStorage.GetReadStream(fileName) : null;
+ }
+
+ #endregion
+
public static string BuildLogoFileName(WhiteLabelLogoTypeEnum type, String fileExt, bool general)
{
return String.Format("logo_{0}{2}.{1}", type.ToString().ToLowerInvariant(), fileExt, general ? "_general" : "");
@@ -500,6 +541,8 @@ public void Save(int tenantId, bool restore = false)
{
SettingsManager.Instance.SaveSettings(this, tenantId);
SetNewLogoText(tenantId, restore);
+
+ TenantLogoManager.RemoveMailLogoDataFromCache();
}
private void SetNewLogoText(int tenantId, bool restore = false)
diff --git a/web/studio/ASC.Web.Studio/About.aspx b/web/studio/ASC.Web.Studio/About.aspx
index ff2c56851..a1114b8ae 100644
--- a/web/studio/ASC.Web.Studio/About.aspx
+++ b/web/studio/ASC.Web.Studio/About.aspx
@@ -28,7 +28,7 @@
<%: Resource.AboutPersonalQuestionHeader %>
<%= String.Format(Resource.AboutPersonalQuestionText.HtmlEncode(),
- "", "","") %>
+ "", "","") %>
\ No newline at end of file
diff --git a/web/studio/ASC.Web.Studio/Core/Notify/NotifyConfiguration.cs b/web/studio/ASC.Web.Studio/Core/Notify/NotifyConfiguration.cs
index 0f5019581..c43f78edc 100644
--- a/web/studio/ASC.Web.Studio/Core/Notify/NotifyConfiguration.cs
+++ b/web/studio/ASC.Web.Studio/Core/Notify/NotifyConfiguration.cs
@@ -28,7 +28,6 @@
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Net;
using System.Runtime.Remoting.Messaging;
using System.Text.RegularExpressions;
using System.Threading;
@@ -285,49 +284,65 @@ private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest req
private static void AddLetterLogo(NotifyRequest request)
{
- var logoUrl = CommonLinkUtility.GetFullAbsolutePath(TenantLogoManager.GetLogoDark(true));
-
if (CoreContext.Configuration.Standalone)
{
- var attachment = ConvertImageUrlToAttachment(logoUrl);
+ try
+ {
+ var logoData = TenantLogoManager.GetMailLogoDataFromCache();
+
+ if (logoData == null)
+ {
+ var logoStream = TenantLogoManager.GetWhitelabelMailLogo();
+ logoData = ReadStreamToByteArray(logoStream) ?? GetDefaultMailLogo();
+
+ if (logoData != null)
+ TenantLogoManager.InsertMailLogoDataToCache(logoData);
+ }
- if (attachment != null)
+ if (logoData != null)
+ {
+ var attachment = new NotifyMessageAttachment
+ {
+ FileName = "logo.png",
+ Content = logoData,
+ ContentId = MimeUtils.GenerateMessageId()
+ };
+
+ request.Arguments.Add(new TagValue(Constants.LetterLogo, "cid:" + attachment.ContentId));
+ request.Arguments.Add(new TagValue(Constants.EmbeddedAttachments, new[] { attachment }));
+ return;
+ }
+ }
+ catch (Exception error)
{
- request.Arguments.Add(new TagValue(Constants.LetterLogo, "cid:" + attachment.ContentId));
- request.Arguments.Add(new TagValue(Constants.EmbeddedAttachments, new[] {attachment}));
- return;
+ LogManager.GetLogger(typeof(NotifyConfiguration)).Error(error);
}
}
+ var logoUrl = CommonLinkUtility.GetFullAbsolutePath(TenantLogoManager.GetLogoDark(true));
+
request.Arguments.Add(new TagValue(Constants.LetterLogo, logoUrl));
}
- private static NotifyMessageAttachment ConvertImageUrlToAttachment(string url)
+ private static byte[] ReadStreamToByteArray(Stream inputStream)
{
- try
- {
- var uri = new Uri(url).AbsoluteUri;
-
- var filename = Path.GetFileName(uri) ?? "logo.png";
-
- byte[] imageData;
-
- using (var wc = new WebClient())
- imageData = wc.DownloadData(url);
+ if (inputStream == null) return null;
- if (imageData == null) return null;
-
- return new NotifyMessageAttachment
- {
- FileName = filename,
- Content = imageData,
- ContentId = MimeUtils.GenerateMessageId()
- };
- }
- catch (Exception)
+ using (inputStream)
{
- return null;
+ using (var memoryStream = new MemoryStream())
+ {
+ inputStream.CopyTo(memoryStream);
+ return memoryStream.ToArray();
+ }
}
}
+
+ public static byte[] GetDefaultMailLogo()
+ {
+ var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "skins", "default", "images", "onlyoffice_logo", "dark_general.png");
+
+ return File.Exists(filePath) ? File.ReadAllBytes(filePath) : null;
+ }
}
}
diff --git a/web/studio/ASC.Web.Studio/Products/Files/ASC.Web.Files.csproj b/web/studio/ASC.Web.Studio/Products/Files/ASC.Web.Files.csproj
index c6ef0fa2b..30fa8ec85 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/ASC.Web.Files.csproj
+++ b/web/studio/ASC.Web.Studio/Products/Files/ASC.Web.Files.csproj
@@ -149,13 +149,6 @@
docusignhandler.ashx
-
- ShareLink.aspx
- ASPXCodeBehind
-
-
- ShareLink.aspx
-
Box.aspx
ASPXCodeBehind
@@ -264,7 +257,6 @@
-
@@ -291,8 +283,6 @@
-
-
@@ -371,7 +361,6 @@
-
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Controls/AccessRights/accessrights.js b/web/studio/ASC.Web.Studio/Products/Files/Controls/AccessRights/accessrights.js
index 5f7dff955..8fe5081a7 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Controls/AccessRights/accessrights.js
+++ b/web/studio/ASC.Web.Studio/Products/Files/Controls/AccessRights/accessrights.js
@@ -135,10 +135,13 @@ window.ASC.Files.Share = (function () {
var link = encodeURIComponent(shareLinkShort);
linkPanel.find(".google").attr("href", ASC.Resources.Master.UrlShareGooglePlus.format(link));
- linkPanel.find(".facebook").attr("href", ASC.Resources.Master.UrlShareFacebook.format(link, objectTitle, "", ""));
+ linkPanel.find(".facebook").attr("href", ASC.Resources.Master.UrlShareFacebook.format(link, encodeURIComponent(objectTitle), "", ""));
linkPanel.find(".twitter").attr("href", ASC.Resources.Master.UrlShareTwitter.format(link));
- var fileId = ASC.Files.UI.parseItemId(objectID).entryId;
- linkPanel.find(".mail").attr("href", ASC.Files.Constants.UrlShareLink.format(fileId));
+
+ var urlShareMail = "mailto:?subject={1}&body={0}";
+ var subject = ASC.Files.FilesJSResources.shareLinkMailSubject.format(objectTitle);
+ var body = ASC.Files.FilesJSResources.shareLinkMailBody.format(objectTitle, shareLinkShort);
+ linkPanel.find(".mail").attr("href", urlShareMail.format(encodeURIComponent(body), encodeURIComponent(subject)));
};
var openShareLinkAce = function () {
@@ -188,11 +191,53 @@ window.ASC.Files.Share = (function () {
if (jq("#studio_sharingSettingsDialog #shareLinkBody").length == 0) {
jq("#sharingSettingsDialogBody").prepend(jq("#shareLinkBody"));
- jq("#shareViaSocPanel").on("click", "a", function () {
+ jq("#shareViaSocPanel").on("click", "a:not(.mail)", function () {
window.open(jq(this).attr("href"), "new", "height=600,width=1020,fullscreen=0,resizable=0,status=0,toolbar=0,menubar=0,location=1");
return false;
});
+ if (!ASC.Resources.Master.Personal) {
+ jq("#shareViaSocPanel").on("click", "a.mail", function () {
+
+ var openLink = jq(this).attr("href");
+
+ var winMail = window.open("");
+ try {
+ if (winMail) {
+ winMail.document.write(ASC.Resources.Master.Resource.LoadingPleaseWait);
+ winMail.document.close();
+ }
+ } catch (e) {
+ }
+
+ var message = new ASC.Mail.Message();
+ message.subject = ASC.Files.FilesJSResources.shareLinkMailSubject.format(objectTitle);
+
+ var linkFormat = "{1}";
+ var linkName = linkFormat.format(Encoder.htmlEncode(shareLinkShort), Encoder.htmlEncode(objectTitle));
+ var link = linkFormat.format(Encoder.htmlEncode(shareLinkShort), Encoder.htmlEncode(shareLinkShort));
+ var body = ASC.Files.FilesJSResources.shareLinkMailBody.format(linkName, link);
+
+ message.body = body;
+
+ ASC.Mail.Utility.SaveMessageInDrafts(message)
+ .done(function (_, data) {
+ var url = data.messageUrl;
+ if (winMail && winMail.location) {
+ winMail.location.href = url;
+ } else {
+ winMail = window.open(url, "_blank");
+ }
+ })
+ .fail(function () {
+ winMail.close();
+ window.location.href = openLink;
+ });
+
+ return false;
+ });
+ }
+
jq("#shareLinkOpen").on("click", openShareLinkAce);
jq("#sharingLinkAce select").on("change", changeShareLinkAce);
}
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Controls/EmptyFolder/EmptyFolder.ascx b/web/studio/ASC.Web.Studio/Products/Files/Controls/EmptyFolder/EmptyFolder.ascx
index 0fb8437ac..6fd1279f7 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Controls/EmptyFolder/EmptyFolder.ascx
+++ b/web/studio/ASC.Web.Studio/Products/Files/Controls/EmptyFolder/EmptyFolder.ascx
@@ -16,7 +16,7 @@
FileUtility.InternalExtension[FileType.Presentation]) %>
<% if (!string.IsNullOrEmpty(CommonLinkUtility.GetHelpLink()))
{ %>
- " target="_blank"><%= FilesUCResource.ButtonLearnMore %>
+ " target="_blank"><%= FilesUCResource.ButtonLearnMore %>
<% } %>
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Helpers/Global.cs b/web/studio/ASC.Web.Studio/Products/Files/Helpers/Global.cs
index 16a4f4203..8d5c7910b 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Helpers/Global.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Helpers/Global.cs
@@ -74,8 +74,6 @@ static Global()
public const int MaxTitle = 170;
- public const int MaxEmailCount = 10;
-
public static readonly Regex InvalidTitleChars = new Regex("[\t*\\+:\"<>?|\\\\/]");
public static bool EnableUploadFilter
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Masters/ClientScripts/FilesConstantsResources.cs b/web/studio/ASC.Web.Studio/Products/Files/Masters/ClientScripts/FilesConstantsResources.cs
index 4abc0372f..3d3f24c54 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Masters/ClientScripts/FilesConstantsResources.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Masters/ClientScripts/FilesConstantsResources.cs
@@ -115,8 +115,6 @@ protected override IEnumerable> GetClientVariables(
},
DocuSignFormats = DocuSignHelper.SupportedFormats,
-
- UrlShareLink = ShareLink.Location + "?" + FilesLinkUtility.FileId + "={0}",
})
};
}
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.Designer.cs b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.Designer.cs
index 3264b95a3..a68e7fd76 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.Designer.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.Designer.cs
@@ -708,15 +708,6 @@ public static string ErrorMassage_ManyDownloads {
}
}
- ///
- /// Looks up a localized string similar to Too many addresses.
- ///
- public static string ErrorMassage_ManyEmailAddresses {
- get {
- return ResourceManager.GetString("ErrorMassage_ManyEmailAddresses", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Sorry, this file format isn't supported.
///
@@ -1185,15 +1176,6 @@ public static string ShareFolder {
}
}
- ///
- /// Looks up a localized string similar to Sending link.
- ///
- public static string ShareLinkMail {
- get {
- return ResourceManager.GetString("ShareLinkMail", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Show Versions.
///
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.resx b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.resx
index 606396131..d770d1653 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.resx
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesCommonResource.resx
@@ -330,9 +330,6 @@
Too many downloads.
-
- Too many addresses
-
Sorry, this file format isn't supported
@@ -486,9 +483,6 @@
Share
-
- Sending link
-
Shared with Me
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.Designer.cs b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.Designer.cs
index 8daf571d6..607d14dd9 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.Designer.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.Designer.cs
@@ -519,15 +519,6 @@ public static string EnterComment {
}
}
- ///
- /// Looks up a localized string similar to Complete the fields to send a message.
- ///
- public static string ErrorMassage_EmptyField {
- get {
- return ResourceManager.GetString("ErrorMassage_EmptyField", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to You cannot upload a folder or an empty file.
///
@@ -969,15 +960,6 @@ public static string InfoFolderMoveError {
}
}
- ///
- /// Looks up a localized string similar to Mails successfully sended.
- ///
- public static string InfoMailsSended {
- get {
- return ResourceManager.GetString("InfoMailsSended", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to You do not have access rights to move some file(s).
///
@@ -1195,20 +1177,20 @@ public static string RevisionCurrent {
}
///
- /// Looks up a localized string similar to Enter the recipient email address.
+ /// Looks up a localized string similar to You have been granted access to the {0} document. Click the link below to open the document right now: {1}.
///
- public static string shareLinkMail {
+ public static string shareLinkMailBody {
get {
- return ResourceManager.GetString("shareLinkMail", resourceCulture);
+ return ResourceManager.GetString("shareLinkMailBody", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Message.
+ /// Looks up a localized string similar to You have been granted access to the {0} document.
///
- public static string shareLinkMailMessage {
+ public static string shareLinkMailSubject {
get {
- return ResourceManager.GetString("shareLinkMailMessage", resourceCulture);
+ return ResourceManager.GetString("shareLinkMailSubject", resourceCulture);
}
}
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.resx b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.resx
index 2f5f5d502..7760d79b1 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.resx
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesJSResource.resx
@@ -270,9 +270,6 @@
Enter a comment
-
- Complete the fields to send a message
-
You cannot upload a folder or an empty file
@@ -414,9 +411,6 @@
You cannot move the folder to its subfolder
-
- Mails successfully sended
-
You do not have access rights to move some file(s)
@@ -495,11 +489,11 @@
current
-
- Enter the recipient email address
+
+ You have been granted access to the {0} document. Click the link below to open the document right now: {1}
-
- Message
+
+ You have been granted access to the {0} document
elements: {0}
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.Designer.cs b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.Designer.cs
index 1fc7104d9..695384ae8 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.Designer.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.Designer.cs
@@ -1509,15 +1509,6 @@ public static string LinkViaMail {
}
}
- ///
- /// Looks up a localized string similar to Send.
- ///
- public static string LinkViaMailSend {
- get {
- return ResourceManager.GetString("LinkViaMailSend", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Login.
///
@@ -1851,33 +1842,6 @@ public static string SharedForMe {
}
}
- ///
- /// Looks up a localized string similar to Message.
- ///
- public static string ShareLinkMailMessage {
- get {
- return ResourceManager.GetString("ShareLinkMailMessage", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Add a comment.
- ///
- public static string ShareLinkMailMessageTitle {
- get {
- return ResourceManager.GetString("ShareLinkMailMessageTitle", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Send a link to the following addresses:.
- ///
- public static string ShareLinkMailTo {
- get {
- return ResourceManager.GetString("ShareLinkMailTo", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Set up the access right for the link.
///
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.resx b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.resx
index 5fabe9f04..82864ba4b 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.resx
+++ b/web/studio/ASC.Web.Studio/Products/Files/Resources/FilesUCResource.resx
@@ -585,9 +585,6 @@
via email
-
- Send
-
Login
@@ -690,15 +687,6 @@
Shared with Me
-
- Send a link to the following addresses:
-
-
- Message
-
-
- Add a comment
-
Set up the access right for the link
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.Designer.cs b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.Designer.cs
index 83a9d18e7..3d2701ea2 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.Designer.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.Designer.cs
@@ -86,19 +86,6 @@ public static string pattern_DocuSignStatus {
}
}
- ///
- /// Looks up a localized string similar to h1. Access granted to document: "$DocumentTitle":"$DocumentURL"
- ///
- ///$__DateTime $__AuthorName ("$UserEmail":"mailto:$UserEmail") granted you the access to the "$DocumentTitle":"$DocumentURL" document with the following access rights: "$AccessRights".
- ///
- ///$Message.
- ///
- public static string pattern_LinkToEmail {
- get {
- return ResourceManager.GetString("pattern_LinkToEmail", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to h1. Mailing completed
///
@@ -178,15 +165,6 @@ public static string subject_DocuSignStatus {
}
}
- ///
- /// Looks up a localized string similar to Documents. You are granted access to $DocumentTitle.
- ///
- public static string subject_LinkToEmail {
- get {
- return ResourceManager.GetString("subject_LinkToEmail", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Documents. Mailing is complete..
///
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.resx b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.resx
index 29fa48653..ac8363c29 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.resx
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/FilesPatternResource.resx
@@ -117,13 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- h1. Access granted to document: "$DocumentTitle":"$DocumentURL"
-
-$__DateTime $__AuthorName ("$UserEmail":"mailto:$UserEmail") granted you the access to the "$DocumentTitle":"$DocumentURL" document with the following access rights: "$AccessRights".
-
-$Message
-
h1. All signers completed $DocumentTitle
@@ -165,9 +158,6 @@ $Message
^You receive this email because you are a registered user of the "${__VirtualRootPath}":"${__VirtualRootPath}" portal. If you do not want to receive the notifications about the shared folders, please manage your "subscription settings":"$RecipientSubscriptionConfigURL".^
-
- Documents. You are granted access to $DocumentTitle
-
Documents. All signers completed $DocumentTitle
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyClient.cs b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyClient.cs
index 8152b403d..bb1ec91fd 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyClient.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyClient.cs
@@ -93,32 +93,6 @@ public static void SendMailMergeEnd(Guid userId, int countMails, int countError)
);
}
- public static void SendLinkToEmail(File file, String url, String message, List addressRecipients)
- {
- if (file == null || String.IsNullOrEmpty(url))
- throw new ArgumentException();
-
- foreach (var recipients in addressRecipients
- .Select(addressRecipient => (IRecipient) (new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), String.Empty, new[] {addressRecipient}, false))))
- {
- Instance.SendNoticeToAsync(
- NotifyConstants.Event_LinkToEmail,
- null,
- new[] {recipients},
- new[] {ASC.Core.Configuration.Constants.NotifyEMailSenderSysName},
- null,
- new TagValue(NotifyConstants.Tag_DocumentTitle, file.Title),
- new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
- new TagValue(NotifyConstants.Tag_AccessRights, GetAccessString(file.Access, CultureInfo.CurrentUICulture)),
- new TagValue(NotifyConstants.Tag_Message, message.HtmlEncode()),
- new TagValue(NotifyConstants.Tag_UserEmail, CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).Email),
- new TagValue(CommonTags.WithPhoto, CoreContext.Configuration.Personal ? "personal" : ""),
- new TagValue(CommonTags.IsPromoLetter, CoreContext.Configuration.Personal ? "true" : "false"),
- new TagValue("noUnsubscribeLink", "true")
- );
- }
- }
-
public static void SendShareNotice(FileEntry fileEntry, Dictionary recipients, string message)
{
if (fileEntry == null || recipients.Count == 0) return;
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyConstants.cs b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyConstants.cs
index 7e3798f09..7170f960e 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyConstants.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifyConstants.cs
@@ -37,7 +37,6 @@ public static class NotifyConstants
public static readonly INotifyAction Event_MailMergeEnd = new NotifyAction("MailMergeEnd", "mail merge end");
public static readonly INotifyAction Event_ShareDocument = new NotifyAction("ShareDocument", "share document");
public static readonly INotifyAction Event_ShareFolder = new NotifyAction("ShareFolder", "share folder");
- public static readonly INotifyAction Event_LinkToEmail = new NotifyAction("LinkToEmail", "link to email");
#endregion
@@ -48,7 +47,6 @@ public static class NotifyConstants
public static readonly string Tag_DocumentUrl = "DocumentURL";
public static readonly string Tag_AccessRights = "AccessRights";
public static readonly string Tag_Message = "Message";
- public static readonly string Tag_UserEmail = "UserEmail";
public static readonly string Tag_MailsCount = "MailsCount";
#endregion
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifySource.cs b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifySource.cs
index 3321f9abc..15ea8efff 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifySource.cs
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/NotifySource.cs
@@ -49,8 +49,7 @@ protected override IActionProvider CreateActionProvider()
{
return new ConstActionProvider(
NotifyConstants.Event_ShareFolder,
- NotifyConstants.Event_ShareDocument,
- NotifyConstants.Event_LinkToEmail);
+ NotifyConstants.Event_ShareDocument);
}
protected override IPatternProvider CreatePatternsProvider()
diff --git a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/patterns.xml b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/patterns.xml
index 62a5ddc05..c39fcafa2 100644
--- a/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/patterns.xml
+++ b/web/studio/ASC.Web.Studio/Products/Files/Services/NotifyService/patterns.xml
@@ -62,20 +62,4 @@ $Message
$__VirtualRootPath/products/files/#$FolderID