#1311 deleting links permission

This commit is contained in:
Karel.Picman 2021-11-26 15:23:06 +01:00
parent df53bdabed
commit 586d3491f3
2 changed files with 12 additions and 8 deletions

View File

@ -77,18 +77,20 @@
title: l(:title_notifications_not_active_activate),
class: 'icon-only icon-email-add' %>
<% end %>
<% # Delete %>
<% if @issue.attributes_editable? && User.current.allowed_to?(:file_delete, dmsf_file.project) %>
<%= link_to '',
<% else %>
<span class="icon-only"></span>
<span class="icon-only"></span>
<% end %>
<% # Delete %>
<% if @issue.attributes_editable? &&
((link && User.current.allowed_to?(:file_manipulation, dmsf_file.project)) ||
(!link && User.current.allowed_to?(:file_delete, dmsf_file.project))) %>
<%= link_to '',
link ? dmsf_link_path(link, commit: 'yes', back_url: issue_path(@issue)) : dmsf_file_path(id: dmsf_file, commit: 'yes', back_url: issue_path(@issue)),
data: { confirm: l(:text_are_you_sure) },
method: :delete,
title: l(:button_delete),
class: 'icon-only icon-del' %>
<% end %>
<% else %>
<span class="icon-only"></span>
<span class="icon-only"></span>
<% end %>
<% # Approval workflow %>
<% wf = DmsfWorkflow.find_by(id: dmsf_file.last_revision.dmsf_workflow_id) if dmsf_file.last_revision.dmsf_workflow_id %>

View File

@ -267,7 +267,9 @@ module RedmineDmsf
title: l(:title_notifications_not_active_activate), class: 'icon icon-email-add')
end
# Delete
if issue.attributes_editable? && User.current.allowed_to?(:file_delete, dmsf_file.project)
if issue.attributes_editable? &&
((link && User.current.allowed_to?(:file_manipulation, dmsf_file.project)) ||
(!link && User.current.allowed_to?(:file_delete, dmsf_file.project)))
html << link_to('',
link ? dmsf_link_path(link, commit: 'yes') : dmsf_file_path(id: dmsf_file, commit: 'yes'),
data: { confirm: l(:text_are_you_sure) }, method: :delete, title: l(:button_delete),