Posting this on Workbench because it effects both Workbench Files and Workbench Media.
I'd like to be able to upload files and media to a folder based on what section the file is being used for or the user wants the file in. So a user is uploading a PDF to a page in the Exhibits section, that PDF would be uploaded to files/exhibits/filename.pdf. Permissions to use (and view in My Workbench->File List) the file would be set as if the file was a node.
Or the user is directly uploading something via the Upload Media interface, that user would select the folder to upload based on what sections the user was given permissions for.
There also could be a Public folder where users can upload files for anyone to use.
If I was uploading an image, then I would be presented with options on what Image Styles to apply. And whatever other image editing features can be used.
A lot of this can already be done in the IMCE module. But, configuring where files get uploaded to, and other stuff is somewhat opaque. Getting IMCE to match the sections I set up in Workbench Access could be somewhat annoying.
Perhaps I really want integration between Workbench and IMCE?
Have features like this been discussed elsewhere? I didn't read every issue in the Workbench issue queues...
Anyway, not sure I've been very clear, only about an hour until I leave the office... So, please tell me where I need to clarify what I mean.
Comments
Comment #1
jerrac commentedSo, after investigating IMCE more, it looks like I will have to create a role for each of my 100+ sections, then create an IMCE profile for each of those 100+ roles.
I'd really much rather do everything with Workbench. Any suggestions on how I can do that with the current feature set?
Comment #2
agentrickardNo. We'd have to understand the feature request and build in the functionality.
Can you clearly list the desired features of an integration? E.g.
1. When user does X .... Y happens
2. Files are stored in Z location....
3. And so on.
Personally, I'd look for another solution than IMCE forcing hundreds of configurations.
Comment #3
jerrac commentedOk, let's see if I can do a better job of explaining things.
Say we have sections laid out in Workbench Access like this:
*S1
*S2
**SS2-1
*S3
U1 has access to all of S1, U2 has access to all of S2, U13 has access to all of S1 and S3, as well as SS2-1.
When U1 uploads files via the "Media Upload" form, it all goes into a folder specific to S1. Likewise for U2.
When U13 uploads files via the "Media Upload" form, they have to select where it goes. So they choose S1, S3, or SS2-1, and the file is stored in the appropriate folder.
If an admin wants a public folder, they can just create a public section and add everyone to it. Unless there's a better way...
When U1 wants to add media to their content, they can only use/see files that are in S1. U2 only gets stuff in S2.
When U13 wants to add media to their content, they can use anything in S1, S3, or SS2-1. Though I'm not sure how I'd want to deal with U13 putting an image from S3 into a page in S1...
Hopefully that is clear enough.
On a slightly different track, do you have any idea if it would be possible to create a Workbench Access IMCE Bridge module?
Basically, it would let me assign IMCE profiles to Workbench sections.
*goes off to see if he could figure out how to do it himself*
Comment #4
agentrickardIt should be possible. IMCE would build from the 'tree' created by the active access scheme.
The following is cribbed from workbench_access_form_alter(), and builds the access tree for the user.
The resulting $tree array will tell you what sections a user can access. See the documentation of hook_workbench_access_tree() for details of that structure.
You may also want to prepend the name of the active scheme (taxonomy, menu) to the folders. Find this using
variable_get('workbench_access', 'taxonomy')Comment #5
agentrickardI'm going to split that out into a useful function. See #1121124: Build workbench_access_get_user_tree().
Comment #6
jerrac commentedOk, I used the patch from #1121124.
Now, to make sure I understand things correctly, workbench_access_get_user_tree returns an array of the sections that the user has permissions for. Correct?
Comment #7
agentrickardYes. The sections the user is assigned to, which assumes permissions in most cases.
Comment #8
agentrickardMoving to other queue.
Comment #9
jerrac commentedThanks! Now, to figure out what I need to do in IMCE. :D
Would workbench_access_get_access_tree() be the function to call in order to get an array of the sections I have enabled?
Comment #10
agentrickardTo find out what's enabled, you want workbench_access_get_active_tree() and inspect the 'active' element of the returned array.
wotkbench_access_get_access_tree() is a helper function for determining user access.
Comment #11
jerrac commentedWell, I've started working on it. Currently stuck for the day though. You can see where I've asked for more help here: http://drupal.org/node/1132654
Hopefully I'll be able to get this working well. :D
Comment #12
agentrickardComment #13
nmillin commentedI know this is an old issue, but in case anyone runs across this issue looking for a solution check out https://www.drupal.org/sandbox/nmillin/2503037. I created this module to solve the exact same issue you are describing (integrating Workbench Access & IMCE).
Check out the sandbox project and let me know what you think.
Comment #14
nmillin commentedSo I finished up the sandbox project and promoted it to a full project. Hopefully this will help someone else in the future.
https://www.drupal.org/project/workbench_access_imce