Hi, and thanks for your question!
shadowdao Which leads me to the issue I am facing. Since I am running the scripts as a user that has visibility into all customer's accounts and has write access to all the accounts, I need a way to make sure that the files that get created are owned by the client's user, not the super user.
I know I could edit the code directly and make it change owner after the file/directory is created or moved from upload, but I would rather not have to make that change every time you release an update.
I understand the issue, but it's a bit unclear from the above how your system works. If you have Files Gallery installed for each customer, surely it could inherit that customers user in the first place? Also, we are speaking of "user" of the file system here, like the PHP-user? I guess my point is, it's difficult for me to make any suggestions without understanding the full context. Ideally, the owner of the index.php
file should be the same user as the files that get managed. Optionally, I'm pretty sure there is a way in server/PHP settings to force files that get created in a specific dir, to be owned by the owner of the dir, and not the owner of the PHP file that creates them.
shadowdao Ideally there would be a hook that I could write a plugin for to change ownership of the newly created element to the user that is logged in.
Even if there was some plugin/API, it's not usual for PHP to be able to change the OWNER of files after they get created. After all, this is one of the reasons for users. Besides, how would you distinguish what client "user" triggers the file creation?
shadowdao Alternatively, it could be a option in the config that would perform the action based on if values for user and group have been set in the config.
Just to be clear, we are speaking of your system users right? Next release in Files Gallery will be about multi-user login with permissions, which could be related to your request, but these "users" have nothing to do with your server users. Just to avoid any confusion. Also, from the above, it seems like you want to use a single Files Gallery index.php
for multiple users/websites? I don't see how you intend to do this without customizing in the first place.
Thanks again for feedback. Happy to assist further, but I might need more information to provide better suggestions.