Merge pull request #4336 from okriuchykhin/ok_SCI_7073

Fix result with WOPI file creation [SCI-7073]
This commit is contained in:
Alex Kriuchykhin 2022-08-10 11:24:27 +02:00 committed by GitHub
commit b91d9e3a28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -22,7 +22,7 @@ Canaid::Permissions.register_for(Asset) do
when Step
can_manage_step?(user, object)
when Result
can_manage_result?(object)
can_manage_result?(user, object)
when RepositoryCell
if object.repository_column.repository.is_a?(RepositorySnapshot)
false

View file

@ -104,7 +104,6 @@ class AssetSerializer < ActiveModel::Serializer
end
def urls
@user = scope[:user] || @instance_options[:user]
urls = {
preview: asset_file_preview_path(object),
download: rails_blob_path(object.file, disposition: 'attachment'),
@ -113,7 +112,8 @@ class AssetSerializer < ActiveModel::Serializer
marvin_js: marvin_js_asset_path(object),
marvin_js_icon: image_path('icon_small/marvinjs.svg')
}
if can_manage_asset?(@user, object)
user = scope[:user] || @instance_options[:user]
if can_manage_asset?(user, object)
urls.merge!(
toggle_view_mode: toggle_view_mode_path(object),
edit_asset: edit_asset_path(object),
@ -122,9 +122,7 @@ class AssetSerializer < ActiveModel::Serializer
delete: asset_destroy_path(object)
)
end
if wopi && can_manage_asset?(@user, object)
urls[:wopi_action] = object.get_action_url(@user, 'embedview')
end
urls[:wopi_action] = object.get_action_url(user, 'embedview') if wopi && can_manage_asset?(user, object)
urls[:blob] = rails_blob_path(object.file, disposition: 'attachment') if object.file.attached?
urls