Most of the work on the site is complete - one of the last things to do is getting things set up so that the users can take care of editing nodes and uploading files. However, to make sure things are kept under control, they will only be allowed to edit specific nodes and only upload files to certain directories. I have searched around but, unfortunately, have absolutely no idea how to implement either of these things, and have to ask two questions:

Username-/Role-Based Permissions for Nodes

What method(s) would allow users, based on their username and/or role, to edit only a specific set of nodes? This would also have to allow users to create certain node types as well, retaining the same permissions as before, so these permissions won't have to be manually applied every time a new node is created.

Username-/Role-Based Permissions for File Uploads

Like the first question, would there also be a way - again, based on username and/or role - for someone to only be able to upload files to (and, if possible, delete files from) a specific directory? Let me note that they would not be placed in Drupal's "files" directory, but in a subfolder of a separate "files" directory* depending on username/role.

(* - I have Drupal in its own directory to make it easier to upgrade when new releases come out, and am using a "files" directory separate from its own to ensure certain files won't be deleted by mistake if I have to mess around with anything in Drupal's folder.)

Please let me know of any modules, guides, etc. that would be of use here.

Thank you very much for any help you can provide.

Comments

Wolfey’s picture

I figured out the answer to one of my two questions:

For nodes, create roles, set up their permissions and add users to them. After that, use Nodeaccess to grant the "Edit" permission to the role(s) and/or user(s) that will be taking care of a particular node.

Unfortunately, for file uploads, I still have no idea how this would be implemented. Any suggestions?

Wolfey’s picture

It looks like I won't be needing Nodeaccess after all - there will only be one user account per department, so changing the "Authored by:" field to the name of the proper user will be enough.

As for file uploads...it's at the point where I have to get that working, and soon - IMCE looks like what I need in this case.

When I first started using it, I could not figure out how to set it up so that a user can access only the (already-created) directory assigned to them. The only settings I could edit were for "user 1" and "authenticated user". After looking around for awhile, I found something interesting - it was a page titled "Practical Drupal", which had a section on IMCE. The first picture in that section (under "IMCE in Action") showed other roles in IMCE's settings, which meant that it should be possible to set up IMCE for other roles on the site.

I went to the "Access control" section of the site and noticed that only "authenticated user" was checked for the "access imce" permission. After unchecking that role and checking all other (manually-created) roles for that permission, I found that I could now set up IMCE for those roles individually - in this case, using the shared folder setting, set to the name of the folder I want that role to use.

Once that was done, I tested out those user accounts and noticed that I can now look for files in (and upload files to) a specific directory, depending on which account I'm using - that is exactly what I've wanted to do with this.

One issue remains, though, due to how this is set up: with IMCE, is there any way to allow a user to have access to two folders (not a subfolder within a folder, but two separate folders at the same directory level)? If not, is there another way to do so, such as with a different module or by patching a file somewhere? If not, and there's no other way it can be done (FTP would have worked, but I can't get another account for it), I'll set up another account (and role) for that user - it would complicate things a bit (they'd have two accounts to manage instead of one), but it is something that is required for the site.

Wolfey’s picture

In order to allow IMCE to recognize the other "files" directory (the one outside of Drupal's directory), I have had to set the file system path to ../files. When adding a link or image via TinyMCE, this causes its path to start with /../files/.

Unfortunately, these paths do not work properly in Internet Explorer 6 - images will show up as broken and links will lead to an "Error 400 / Bad Request" page. When viewing the properties of any link or image using that path, they show up with /../files/ in the address, instead of /files/.

The other browsers I have tested (Firefox, Internet Explorer 7 and Opera) are not affected by this - images and links will load properly and when viewing the properties of any link or image using that path, they show up with /files/ in the address.

Would there be a workaround for this, such as modifying TinyMCE to replace /../files/ with /files/ when adding/editing paths?