Hi All,
I have a website with multi groups, each group has multi users.
The Groups/Users :
GroupA has users : userA1, user A2, userA3
GroupB has users : userB1, userB2, userB3
The directories :
..../images/GroupA/gallery
..../images/GroupA/slideshow
..../images/GroupB/gallery
..../images/GroupB/slideshow
..../images/default
.../images/GroupA as the image Rootpath of GroupA
.../images/GroupB as the image Rootpath of GroupB
If userA1, userA2 or userA3 wants to upload image in TinyMCE / FckEditor, he will only see their image Root path : ’GroupA’ (they can not access directory ’images’ or ’images/GroupB’
but they can see directory ’GroupA/gallery’ or ’GroupA/slideshow’) & they can create SubDirectory under ’GroupA’ or ’GroupA/subdir/subdir’ ...
This is also the same for userB1, userB2, userB3. They can’t access the directory ’GroupA’ or its Subdirectory, just can access directory ’GroupB’
I found this solution (FckEditor) :
http://cksource.com/forums/viewtopic.php?f=6&t=7758&start=10 (Using COOKIES).
I think it can be done also in Modx. I must get the GroupName of the logged in user, set it as the ’UserFilesPath’ may be like this :
=================== Setting cookie =========================
setcookie(’fckuserid’, $GroupName, time()+86400*30, ’/’);
....
=================== Edit fckeditor’s config.php file =================
if (!empty($_COOKIE[’fckuserid’]))
$Config[’UserFilesPath’] = ’/images/’.$_COOKIE[’fckuserid’];
else
$Config[’UserFilesPath’] = ’/images/default/’;
....
==================== Edit fckconfig.js file =============
FCKConfig.PreserveSessionOnFileBrowser = true ;
The problems :
*) How to get the GroupName of current logged in user if we know the userId via $modx->getLoginUserID(’mgr’) ?
*) Where must I set the Cookie: at Template, TV, chunks, snippets, module, or other ?
*) How to get the cookies value in Modx (it’s the same like normal php ways: $_COOKIE(’fckuserid’) ?
*) Any other tips to implement this in Modx ? Any information will be very helpful.
Many thanks.
- pedma -