I m a beginner to PHP
and MySQL
, I am having 3 user roles in my project:
- manager
- editor
- mtuser
Managers account can upload files to the system. Editors and mtusers are able to download file uploaded开发者_如何学C by a manager, they can modify those and reupload back to managers (feedback).
I am using a temp directory to store those files on the server.
I want to check with that file like suppose editor and mt user should not uploaded rather then downloaded files how I check that?
I also want to avoid collisions where several users try and write to the same file at once.
I think you want to make use of WebDAV, which is easy to do with PHP. This will allow other users to lock files for editing, so that you avoid collisions.
Regarding the rest, getting permissions is just a simple query away. I'm assuming that you have a table named 'permissions' or something that says what a user can and can not do. What I do recommend is not caching them (i.e. in a session), make sure they are easy to revoke.
精彩评论