Thread:Project:Support desk/Restricted Access to all ftp links (2)/reply

Hi!

I could imagine the following:

Maybe you could use JavaScript (jQuery?) to modify FTP/SFTP links the way you like. However, that means you would have to have the user's password available in JavaScript in cleartext. My gut feeling is that this is no good idea.

Another possibility: Use a hook, which allows you to modify links while MediaWiki creates them. Manual:Hooks/LinkerMakeExternalLink might be a choice. In this hook, check $url to see, if it's a FTP/SFTP link and if so, use $wgUser to change $url so that it contains the current user's username/password the way you showed above.

However, note that this will have the drawback that you MUST deactivate caching - otherwise MediaWiki will serve users pages with the links, which have been created for other users. Not only that they would then be allowed to access the files although they should not, even worth: They will also be able to see the other users' passwords.