<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I remember I had this working in the past.</p>
<p>Now Nextcloud made the things complicated because by default it
assign to ldap users some random id's . But in advanced
configuration it is still possible to change the id's to user's
uid or mail ( seems to be distructive if you already use nextcloud
but should work for new installations.</p>
<p>After changing the mapping I still have problems because in this
config:</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">$config['fileapi_sources']
= array(
</span><br>
<br>
<br>
'private-nextcloud' => array(
<br>
'driver' => 'webdav',
<br>
'baseuri' =>
'<a class="moz-txt-link-freetext" href="http://localhost/cloud/remote.php/dav/files/">http://localhost/cloud/remote.php/dav/files/</a>',
<br>
'username' => '%u',
<br>
'password' => '%p',
<br>
),<br>
<br>
</span></p>
<p>the %u is not expanded in baseuri to the user name. <span
style="font-family:monospace"><br>
</span></p>
<p>I was able to solve that changing in function<span
style="font-family:monospace"> init()</span></p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> </span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->client =
</span><span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">new</span><span
style="color:#000000;background-color:#ffffff;"> </span><span
style="color:#b2b2b2;background-color:#ffffff;">Client(</span><span
style="color:#18b218;background-color:#ffffff;">array</span><span
style="color:#b2b2b2;background-color:#ffffff;">(</span><span
style="color:#000000;background-color:#ffffff;">
</span><br>
<span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'baseUri'</span><span
style="color:#000000;background-color:#ffffff;"> => </span><span
style="color:#b2b2b2;background-color:#ffffff;">rtrim(</span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->config[</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'baseuri'</span><span
style="color:#000000;background-color:#ffffff;">], </span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'/'</span><span
style="color:#000000;background-color:#ffffff;">) . </span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'/'</span><span
style="color:#000000;background-color:#ffffff;">.</span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->config[</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'username'</span><span
style="color:#000000;background-color:#ffffff;">].</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'/'</span><span
style="color:#000000;background-color:#ffffff;">,
</span><br>
<br>
</span></p>
<p> but this need to be removed in <br>
</p>
<p><span style="font-family:monospace"><span
style="font-weight:bold;color:#54ffff;background-color:#ffffff;">function</span><span
style="color:#000000;background-color:#ffffff;"> </span><span
style="color:#b2b2b2;background-color:#ffffff;">get_relative_url(</span><span
style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;">)</span><br>
</span><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> {
</span><br>
<span style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;"> = </span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->client-></span><span
style="color:#b2b2b2;background-color:#ffffff;">getAbsoluteUrl(</span><span
style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;">);</span></span></p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">// added by
me: </span><br>
</span></p>
<p><span style="font-family:monospace"> <span
style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;">=</span><span
style="color:#b2b2b2;background-color:#ffffff;">trim(str_replace(</span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->config[</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'username'</span><span
style="color:#000000;background-color:#ffffff;">],</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">''</span><span
style="color:#000000;background-color:#ffffff;">,</span><span
style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;">),</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'/'</span><span
style="color:#000000;background-color:#ffffff;">);
</span><br>
<span style="color:#b218b2;background-color:#ffffff;">return</span><span
style="color:#000000;background-color:#ffffff;"> </span><span
style="color:#b2b2b2;background-color:#ffffff;">trim(str_replace(</span><span
style="color:#18b2b2;background-color:#ffffff;">$this</span><span
style="color:#000000;background-color:#ffffff;">->config[</span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'baseuri'</span><span
style="color:#000000;background-color:#ffffff;">], </span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">''</span><span
style="color:#000000;background-color:#ffffff;">, </span><span
style="color:#18b2b2;background-color:#ffffff;">$url</span><span
style="color:#000000;background-color:#ffffff;">), </span><span
style="font-weight:bold;color:#ffff54;background-color:#ffffff;">'/'</span><span
style="color:#000000;background-color:#ffffff;">);
</span><br>
}
<br>
<br>
I think this can be useful for accessing private webdav folders
so maybe can be added in the official driver, probably the
simplest way is to allow wildcards in baseuri, this should keep
the driver itself unchanged.</span></p>
<p><span style="font-family:monospace">Mihai<br>
</span><span style="font-family:monospace"><br>
</span></p>
</body>
</html>