pitbulk / dokuwiki-saml

GNU General Public License v2.0
2 stars 10 forks source link

Media becomes inaccessible when savedir is relative #11

Open pv2b opened 5 years ago

pv2b commented 5 years ago

The savedir parameter of dokuwiki is by default set to ./data. If you run Dokuwiki with this kind of configuration, when using the dokuwiki-saml plugin, the media breaks (i.e. pictures stop loading). Also, the media manager becomes unaccessible, because it thinks an admin is no longer an admin.

saml_user_file is set here using $conf['savedir']

https://github.com/pitbulk/dokuwiki-saml/blob/6161c7338d5464fdc8b635e6b96a88615c9ee287/authsaml/saml.php#L58

saml_user_file is later referenced in different places, such as here:

https://github.com/pitbulk/dokuwiki-saml/blob/6161c7338d5464fdc8b635e6b96a88615c9ee287/authsaml/saml.php#L278-L281

However! Depending on where exactly where the code is called from, the current working directory can be different, resulting in that sometimes, when you use a relative path like this, it tries to look at the wrong path. This is true when trying to use media manager.

Workaround: Made sure that $conf['savedir'] is configured as an absolute path, i.e. /var/www/dokuwiki/data in my install. (This is what I've done in my install, rather than try to fix this bug.)

Stopi commented 4 years ago

A thousand thanks for this workaround, I was struggling with displaying pictures for users belonging to an Active Directory group, while the admin was able to see them perfectly.

Now the permissions seems to work correctly, using absolute path for savedir.

pitbulk commented 4 years ago

@pv2b do you have a PR?

pv2b commented 4 years ago

@pitbulk Unfortunately, no. I was able to identify the problem and a workaround, but I'm not familiar enough with the codebase or with PHP to identify where the fix would be best put in place.