Adds support for business servers

If the WOPI_BUSINESS_USERS environmental variable is set and true, indicates to Office online that all users are business users when trying to view/edit files
This commit is contained in:
Nejc Bernot 2017-07-04 14:27:43 +02:00
parent 53a1dd14b7
commit bd9904adb3

View file

@ -380,10 +380,17 @@ class Asset < ActiveRecord::Base
action = get_action(file_ext, action)
if !action.nil?
action_url = action.urlsrc
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER&>/,
if (ENV['WOPI_BUSINESS_USERS']) {
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER&>/,
'IsLicensedUser=1&')
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER>/,
'IsLicensedUser=1')
} else {
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER&>/,
'IsLicensedUser=0&')
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER>/,
action_url = action_url.gsub(/<IsLicensedUser=BUSINESS_USER>/,
'IsLicensedUser=0')
}
action_url = action_url.gsub(/<.*?=.*?>/, '')
rest_url = Rails.application.routes.url_helpers.wopi_rest_endpoint_url(