DAVRoot: Moodle Files through WebDAV

DAVRoot: Moodle Files through WebDAV

by Matteo Scaramuccia -
Number of replies: 8
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Devs,
I've just pushed into GitHub an idea I had some time ago to learn/explore Moodle files in 2.x: at this stage it should be used for debugging purposes in a testing environment, waiting for some external QA before publishing it into the Moodle plugins area.

Find the details here: https://github.com/scara/moodle-local_davroot/tree/master/local/davroot#readme.

Feedbacks are welcome!
Matteo

Average of ratings: -
In reply to Matteo Scaramuccia

Re: DAVRoot: Moodle Files through WebDAV

by Huy Hoang -

hey Matteo,

I've installed your plugin and tested out, very cool! I think we (UMN) have actual needs for it (instructors are looking for an easier way to manage course files).

I looked at both SabreDAV and your davroot codes and couldn't find support for session cookie. I tested with "curl -b -c", and it seems that username and password has to be submitted on every request, and thus, full authentication is carried out for every request. It's a little problematic as we have to go to our central LDAP server for the authentication. I'm looking into incorporating Moodle session into davroot so that the session cookie can be used. I think most WebDAV clients handle cookie well (storing/submitting), so perhaps we can optimize it a bit on that.

what do you think?

thanks

In reply to Huy Hoang

Re: DAVRoot: Moodle Files through WebDAV

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Huy,
cookies for the (Moodle) session are already there: look at complete_user_login($user, false);.

Give Cyberduck client a try: you'll see no need to re-authenticate for each request (as you're guessing), the same applies for the other clients as described in README.txt.

FYI: I'll start working at the TODO section in the next weeks.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: DAVRoot: Moodle Files through WebDAV

by Huy Hoang -

I put various error_log() checkpoints along the code, and tested with this command:

curl --verbose -b cookie_jar.txt -c cookie_jar.txt --basic -u admin  "http://localserver/moodle/local/davroot/davroot.php"

The authentication does happen everytime, even though session cookies are submitted. I think most clients (Cyberduck, Windows Explorer, Nautilus, cadaver ...) cache username/password and send them with every request (thus, don't have to ask user repeatedly)

I modified the code to skip the authentication if the logged in username is the same as the submitted username:

https://github.com/hqhoang/moodle-local_davroot/commit/24710c4db057e84e26b61cca4d26e77a0eeff25d

would that work?

waiting excitedly for more excellent works from you

thanks



In reply to Huy Hoang

Re: DAVRoot: Moodle Files through WebDAV

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Huy,
ohhh... now I've understood: I'll do some extra checks but you've probably hit an issue (and a candidate solution) that can be easily improved. Unfortunately authentication is not the real issue here for improving the performances but...  TNX!

Matteo

In reply to Matteo Scaramuccia

Re: DAVRoot: Moodle Files through WebDAV

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Devs,
git repo updated: SabreDAV 1.5.4, DAVRoot 2011110500.
It should be used for debugging purposes in a testing environment, waiting for more external QA.

Again, feedbacks are welcome!
Matteo

In reply to Matteo Scaramuccia

Re: DAVRoot: Moodle Files through WebDAV

by Chad Bergeron -

Oh, this is clever.  And it may help solve the problem of getting files from an iOS device up into Moodle.  But it doesn't seem to work when users are set to use the My Moodle page by default.  Any chance of exposing the 'Private Files' area?  If I could connect users to that, I'd be the toast of the town.

In reply to Chad Bergeron

Re: DAVRoot: Moodle Files through WebDAV

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Chad,
could you elaborate a bit your setup?

DAVRoot does not relay on My Moodle page: it has its own root URL which serves the WebDAV requests of the DAV client of a user with the new capability, 'local/davroot:canconnect' (by default this cap belongs ONLY to managers e.g. the administrators)

E.g.: if you point your browser as an administrator to http://hostname/path/to/your/moodle/local/davroot/davroot.php you'll see a folder called as the administrator 'full name' and if you click on it you'll see its own 'Private files' folder too (Moodle API is allowing these magics).

Matteo