ozrhod Posted November 4, 2012 Share Posted November 4, 2012 Hi PHPfreakers, I have an intranet that users upload files to. When they upload a file it renamed the file to a GUID string and then stores this in a mySQL db (the db also allows for permissions and file sharing - via the intranet webpage). Now, however, I want to make it so I can get to my files (or ones I have permission to) from My Computer (or the UNIX/Mac/Linux equivalent). I'm learning about webDAV at the moment and thought of this as a potential solution, however I am running into a problem becaause all the files are in one directory, not one firectory per user. Any ideas what I can do? How I can make this work better? Oh, FYI - http://code.google.com/p/sabredav/ this is the library I have been looking at using because of its support for mySQL permissions and PHP library. Hope someone can help Quote Link to comment Share on other sites More sharing options...
ignace Posted November 4, 2012 Share Posted November 4, 2012 It's all right there: http://code.google.com/p/sabredav/wiki/VirtualFilesystems Quote Link to comment Share on other sites More sharing options...
ozrhod Posted November 4, 2012 Author Share Posted November 4, 2012 (edited) It's all right there: http://code.google.c...tualFilesystems As far as I can tell (and please correct me if I am wrong) this will not let me filter files based on a mysql db - i.e., wont be able to achive listing just the files for the specific user and not list ALL the files in the directory. To explain better, this is the setup: root/files -- in this directory ALL user upload files are stored, not in subfolders, they all go straight into this directory with a new name (GUID string). tbl_files -- stores copy of the userid and guid to allow access and listing on intranet webpage (mydomain.com/intranet/files). At the moment lib_files.php restricts access to the files in root/files -- how can I do this with webDAV? When all files come from one folder (no subs) and permissions are in mySQL db? Edited November 4, 2012 by ozrhod Quote Link to comment Share on other sites More sharing options...
ignace Posted November 4, 2012 Share Posted November 4, 2012 You need to use the ACL: http://code.google.com/p/sabredav/wiki/ACL Assuming the users have to login to access the WebDAV, you can filter the nodes they have access to with the ACL. Quote Link to comment Share on other sites More sharing options...
ozrhod Posted November 4, 2012 Author Share Posted November 4, 2012 Thats for CardDAV - and how would I apply the ACL's? All permissions are stored via mySQL DB and handled via a file.php Quote Link to comment Share on other sites More sharing options...
ignace Posted November 5, 2012 Share Posted November 5, 2012 Well, do they login to the webdav? If they do, then it's quite easy to send back only the files they have access to. Quote Link to comment Share on other sites More sharing options...
ozrhod Posted November 5, 2012 Author Share Posted November 5, 2012 But these permissions are not stored on or in the files but through a table in mysql - sorry ignace but what your saying is not really making any method clear or obvious. Quote Link to comment Share on other sites More sharing options...
ignace Posted November 5, 2012 Share Posted November 5, 2012 Well, do they login to the webdav? A simple yes or no. If they do, then it's quite easy to send back only the files they have access to. SELECT files.* FROM users_files JOIN users ON users_files.user_id = users.user_id JOIN files ON users_files.file_id = files.file_id WHERE users.user_id = ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.