Project

General

Profile

How to disable attaching files in issues ?

Added by Sébastien Pochiero over 10 years ago

Hi,

Is there a way to avoid attaching files in issues.

I didn't find in tracker configuration or any pluggin...


Replies (13)

RE: How to disable attaching files in issues ? - Added by Martin Denizet (redmine.org team member) over 10 years ago

Hello Sebastian,
I didn't hear anything about disabling file attachments for issues.
A quick fix would be to hide the input using Redmine Custom CSS plugin
Not great but better than nothing.

Cheers,

RE: How to disable attaching files in issues ? - Added by Sébastien Pochiero over 10 years ago

Thank's Martin but I don't want to hide the input in all trackers.

Why the field can't be hide in the workflow configuration or in the tracker configuration (we can do that for all the others fields) ?

RE: How to disable attaching files in issues ? - Added by Martin Denizet (redmine.org team member) over 10 years ago

You can listen to JavaScript events with Redmine Custom JavaScript plugin
Again, not great but it's a quickfix.

Cheers,

RE: How to disable attaching files in issues ? - Added by Ilya Zadonskiy over 10 years ago

1)Go to: /usr/share/redmine/app/issues => file: form.html.erb
2)Find: id="attachments_form"
3) Comment like this:
4) Reload your apache.

RE: How to disable attaching files in issues ? - Added by Sébastien Pochiero over 10 years ago

thanks,

it works !

using your solution i did that :

edit the file \lib\redmine.rb by adding a new line :
map.permission :upload_file, {}, :require => :member

edit the file \config\locales\fr.yml for the translation by adding a new line :
permission_upload_file: Upload Files

edit the file \app\views\issues\new.html.erb by adding this test :

<% if User.current.allowed_to?(:upload_file, @project) %>
<p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
<% end %>

edit the file \app\views\issues\_edit.html.erb by adding this test :

<% if User.current.allowed_to?(:upload_file, @project) %>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
</fieldset>
<% end %>

now i can manage permissions to upload files in the administration of roles.

RE: How to disable attaching files in issues ? - Added by Martin Denizet (redmine.org team member) over 10 years ago

Good to know you got it working! However i strongly recommend you to move this functionality to a plugin.
It's not recommended to patch Redmine's files as you will have to apply the patch again after each update.
You can check out the Plugin Tutorial.
Cheers,

RE: How to disable attaching files in issues ? - Added by Sébastien Pochiero over 10 years ago

Ok i understand that, but a plugin can add functionality, not replace ?

this line :

<p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>

is native in redmine.

how can i replace it with this 3 lines ?

<% if User.current.allowed_to?(:upload_file, @project) %>
<p id="attachments_form"><label><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
<% end %>

It will be better to add a new feature in a next redmine version ;-)

RE: How to disable attaching files in issues ? - Added by Martin Denizet (redmine.org team member) over 10 years ago

For reference, the "clean" way to override a view is explained in this wiki page.
Cheers,

RE: How to disable attaching files in issues ? - Added by Sébastien Pochiero over 10 years ago

thank's

i made a plugin : http://www.redmine.org/plugins/permission_to_upload

if you want to see it : i'm a rookie !!!

RE: How to disable attaching files in issues ? - Added by Antonio Expósito about 10 years ago

Sébastien Pochiero wrote:

thanks,

it works !

using your solution i did that :

edit the file \lib\redmine.rb by adding a new line :
map.permission :upload_file, {}, :require => :member

edit the file \config\locales\fr.yml for the translation by adding a new line :
permission_upload_file: Upload Files

edit the file \app\views\issues\new.html.erb by adding this test :
[...]

edit the file \app\views\issues\_edit.html.erb by adding this test :
[...]

now i can manage permissions to upload files in the administration of roles.

Hi! And how can I rewrite this lines to create/manage an " Issue Delete Attachment Permission " ?
Is it possible?

Thanks :)

RE: How to disable attaching files in issues ? - Added by Adam Balgach about 9 years ago

Where you ever able to write a plugin to manage deleting files in issues? That would be very helpful for us.

RE: How to disable attaching files in issues ? - Added by Yoonsuk Cho about 9 years ago

Sébastien Pochiero wrote:

Hi,

Is there a way to avoid attaching files in issues.

I didn't find in tracker configuration or any pluggin...

Yes. Thanks. You did good job. :)
I really need to add this plugin into our redmine web site. I did uncompress the zip file of plugin as you've written here.
Then, I found the "Upload files" in issues tracking of "roles and permissions". I've tried the item several times link 'check' and 'uncheck' to verify
how it does works.
But, it never responding. Every time the file upload is visible.

The project I've created before doesn't have any member who has been assigned as a Manager or others. My permission is a Manager of this redmine.
and I've unchecked the "Upload Files" which has been added by plugin you provided. It should be invisible when I click the "New message" or "Edit" link.
But, It still visible. Is there any other way after adding the plugin to make invisible ?

Thanks.

RE: How to disable attaching files in issues ? - Added by Fernanda String over 8 years ago

Is permission_to_upload plugin compatible with redmine version 3.x ?

    (1-13/13)