[support] Roles & IMCE Module

Nick Young nick_young at ncsu.edu
Fri Sep 19 19:08:24 UTC 2008


I am attempting to setup the IMCE module (in Drupal 6), so that the user 
is permitted to manage files within several directories, based on the 
Roles that user is a member of.

Example: Jimmy is a member of the two roles: Team Directors; Drupal Geniuses

I would like to be able to set the paths in the IMCE module to display 
and let him manage those directories (under the site's files root of 
course).

Currently, i have a php snippet that will allow me to set user's default 
IMCE folder automatically by role, but only be a single role. This is 
part of the way there, but my concern is for several users who need to 
be able to access and manage files in multiple directories.

Here is the code snippet, if it helps at all:

php: foreach ($user->roles as $role) { if ($role != 'authenticated user' 
&& $role != 'test role') { return 'roles/'.$role;  } }

This is placed in the Directory path field on the IMCE Profile 
configuration page. Basically, it looks at all the roles the user is a 
member of, and then ignores the pre-set roles that I don't want them to 
have access to (the authenticated user role and test role). Then it 
returns the directory, which in Jimmy's case would be the IMCE file 
root... /roles/Team Directors

It works great for one role, but i haven't figured out how to iterate 
though each role an account might be a member of. This has to scale to 
different users who may be members of different roles, and may be 
members of many more than 2 roles.

Any ideas/solutions would be much appreciated.

--Nick

......................................................................
Nick Young
Outreach, Communications & Consulting
Office of Information Technology
North Carolina State University
Box 7109, Raleigh 27695
Ph. 919.513.2716 | E-Mail: nick_young at ncsu.edu <mailto:nick_young at ncsu.edu>
........................................................................




More information about the support mailing list