Setting to only let staff upload media/attachments

AI 生成的摘要

A discussion is underway about implementing a feature to restrict media uploads to staff members only. Maestra_Powers started the conversation, citing concerns about server space being quickly filled with large files, especially 31 megabyte gifs. They temporarily disabled uploads except for avatars, but want staff to be able to upload images for important topics.

The discussion evolved into a broader idea, suggested by fefrei, to allow staff to upload additional file types, not just restrict image uploads. This would solve the original problem and provide more flexibility.

The proposed solution involves introducing two site settings: one for users and one for staff. codinghorror and fefrei discussed the default values for these settings, with the suggestion to keep the current default for users and set the default for staff to “none.” Admins would be exempt from the check.

Additional ideas were proposed, including a special file size limit for staff, larger than for users, suggested by schungx. A pull request for the feature has been submitted by Osama.

Is it possible yet to allow only staff or moderators to upload pictures? If not, it should be done. I have 20Gb free space on my server, for big community it’s like a month or two to fill. Especially if there’s gonna be 31 megabyte gifs! So I disabled uploading for now (except avatars), but I need my staff to have this feature. Because they create important topics and I don’t want pictures to be missed from there. And I don’t give a care about pics in regular users junk-topics - yes. :troll:

3 个赞

Totally offtopic: Please write more explanative titles, “Only staff can upload” does not give the reader an overview of what your feature is. (I edited the title.)

1 个赞

Sorry, that’s language barier (let’s call it accent). :slight_smile: If I’ll try to write longer topic names, there’s gonna be grammatical mistakes, so someone will have to edit them anyway. But I’ll try my best.) And if I’ll fail, Yoda on my avatar put I will.

4 个赞

I’d really like to see that, too, but in a generalized version: There should be additional file types that staff users only may upload. This solves your problem (you can say that users may not upload any file type, while staff may upload images), but also the problem that you might want to allow uploading more dangerous file types (say .js) by staff (without an admin doing the enable setting—reload site—upload file—disable setting dance).

2 个赞

So two site settings, one for users, the other for staff? What would the default values be? I wonder if it should only apply to admins since many sites don’t trust their moderators that much…

1 个赞

Sounds good!

I’d say:
Default for users: Keep the current default.
Default for additional filetypes for staff users: None.
In addition, I’d completely exempt admins from the check.

This means that…

  • The defaults don’t change for non-admins.
  • Admins can upload anything (which they already could do anyway, but with less comfort).
  • If you want to allow moderators to upload additional file types, you can use the second setting for that.
  • If you want to restrict image upload to staff only, you can remove all filetypes from the user-setting and add image files to the staff-only setting.
4 个赞

Seems like a good idea! @techapj can you add this to your list, low priority?

3 个赞

OK pr-welcome for a new site setting that allows staff extra filetypes.

additional filetypes for staff users default none

Watch out though cause you need to flow the info back into the client so it allows staff to select this stuff.

5 个赞

Since you’re at it, a special file size limit for staff, larger than for users, will be great.

You don’t want users to be uploading 20megapixels photos, but staff should know what they are doing.

I’ve got a PR for this :smile:

https://github.com/discourse/discourse/pull/5364

11 个赞