Fixed upload permissions distinction between public and logged in upload

Fixes #5370

It means that:
- when uploading a file while logged in, it will correctly show the file actions
- when uploading a file on a public link dir, it will only use read permissions, which shows only the Download link instead of all actions

Please review @karlitschek @DeepDiver1975 @schiesbn @kabum