How to suppress "You do not have permission to upload or create files here" message?

I have a shared folder in my nextcloud containing a massive library of family photos, which I maintain externally using lightroom. I don’t want any users including me to be able to upload, delete or change the files here via nextcloud at all. So I have created a group with read only access to the folder and added the users to that group who should have read only access.

This approach is working quite well, except for the long message which displays persistently across the top - see screenshot below. On desktop it is only confusing, but on mobile it takes up space and is quite ugly.

Is there any way to suppress it without modifying the nextcloud software? I guess I could create a new language locale in /var/www/nextcloud/apps/files/l10n and just change it to something short like “read only”?

Honestly this message is awkward and a change in the software would be good - for example to display the message when you try to upload or change something, instead of just always displaying it.

It is part of the (shiped, always enabled) “files” App.

It is in the file

apps/files/templates/list.php in line 8

and in all the subsequent l10n files.

I do not touch the localization files; to much effort - but it would be possible of course. But a message like “Read only” is very good understood internationaly :wink:

I can write you a script, which gives you the means to set it to “Read only” or even remove the message entirely and undo those changes back to default.

Or, if you do not want to wayt, I can give you the required functions to change the message, then you should write your own solution with those code blocks.

You should take into account that the changes are not permanent, but are gone after each update, so you should integrate something like this with a script routine in the update process. I make several such changes to the codebase myself, all of which I can undo with one click, so that I can run integrity tests in between if necessary. After that, I can put the changes back just as easily as I want it to be.

1 Like

Cool! Thanks for the information and offer of help. I am quite keen to keep my installation as close to “vanilla nextcloud” as possible, so that I don’t run into unnecessary issues when upgrading.

It’s great to learn some more about how nextcloud works, so thanks again for that excellent explanation.

Is there a way to make a feature request for the maintainers of nextcloud to consider? Maybe I can make a pull request to suggest a change? :thinking:

On mobile devices you should use the android/ios client instead of a browser. In the mobile client, that message is not shown.

I can take away your worry about problems with update. They cannot arise from this. At least not the way I implement them in my script. With the argument " -r " all made changes will be made undone and you will get your “vanilla nextcloud” back.

Of course you can make a PR but I do not find that message awkward. I find the message is OK and I think that you will not find much suport for that PR. In particular because your argument with the mobile is actually none, because there is a separate solution.
It is much easier to run a little script and change two lines of code for your personal use case and demand instead of changing the code for millions of users who got accustomed to it, like the tail wagging the dog. :wink:

Anyway, I wrote that script for you, it is as good as bullet proof and can’t do any harm.

This is how you should install it:

# Download:
sudo wget -O /usr/local/bin/nc-read-only
# Make it executable
sudo chmod +x /usr/local/bin/nc-read-only
# check integrity of the script
nc-read-only verify_my_integrity

If the integrity test is passed, you can begin using the script. This is the output of the help:

  nc-read-only - version 2023.07.06 14:48 (latest version)

    This script looks up for the hardcoded message for read only content:

        'You do not have permission to upload or create files here'

    and gives you the means to change it with a message of your choice.


    interactive mode:

    batch mode:
          nc-read-only ((-)-)h|((-)-)H|((-)-)help
          nc-read-only ((-)-)r|((-)-)reset|((-)-)d|((-)-)default
          nc-read-only remove
          nc-read-only message="newmessage"
          nc-read-only verify_my_integrity

    options can be with or without preceded '-' or '--'

    h|H|help                This help

    r|reset|d|default       reset everything to default.

    remove                  remove message and icon completely

    message="new message"   Set message to "new message".

    verify_my_integrity     verify the integrity of this script with signature

If you choose to completely remove the message, this little Icon: image will be removed as well. As soon as you define a message, the Icon will be made visible again.

At least give it a try, I hope this makes you happy! :pray:
Much luck!

1 Like

Thanks! I appreciate you writing this script for me. It’s also interesting to see how little problems can be solved in this way. I will try it.

I am not keen on using apps and prefer to access nextcloud using a web browser in my phone. It does work quite well to access my files.

I still think it would be an improvement for everyone using nextcloud to not show this long message persistently in the UI, both on desktop and on mobile. Maybe others will come along later and agree with me and the maintainers will be convinced. (à la Complaint-Driven Development)

Either way this is a small issue for me and I don’t mind just living with it.

1 Like