Hi all,
i'm trying to make a members only kind of page, actually i don't know how to make CMP's so i use the web context for that.
i have a resource group (editorfiles) and a usergroup (editors) that has access to the resourcegroup.
Anyway i'm counting on the premises that once a 'editor' is loggedin in the manager he also has access to a page belongin in that resource group, in the web context. i have
Is that true? or does my member also need to login on the web context separately?
the editorsgroup has cotext acces to mgr and web with a policy of administrator. and resourcegroup acces with a policy of 'resource'.
but when i'm logged in in the manager i can't see the front-end memberpage.
ACL's are realy tough.
RDG
No, being logged into the Manager does not mean you're logged in to any other context. That's why you can't see the front-end web page unless you're also logged in in the front-end context.
You should be able to use a plugin attached to OnManagerLogin to automatically log the person into the front-end context if you need to.
Hoi Bobray,
Thanks i understand. can you point me towards a script that does the login? the addon 'Login' is a bit to complex for me to unraffle.
LHM
OK, this is off the top of my head, but I think it may work. Put this code in a plugin and attach the plugin to the OnManagerLogin event:
$user->addSessionContext('web');
Hi,
I tried it but it doesn't work. i think there must also be some verification to see if the user is allowed to login.
RDG
No, there are no permission checks at that low a level.
See if this works:
$modx->getUser();
$modx->user->addSessionContext('web');
Hoi BobRay,
no that doesn't seem to work either. Is there a way to read to console or PHP echo all the user data (authorisation, context etc)?
so i can see exactly what changes in the user settings after i login on the web context.
RDG
You usually can't echo anything in a plugin, but you can write the data to a chunk (create a chunk called 'Debug').
if (!function_exists("my_debug") && $scriptProperties['debug']) {
function my_debug($message, $clear = false)
{
global $modx;
$chunk = $modx->getObject('modChunk', array('name' => 'Debug'));
if (!$chunk) {
$chunk = $modx->newObject('modChunk', array('name' => 'Debug'));
$chunk->setContent('');
$chunk->save();
$chunk = $modx->getObject('modChunk', array('name' => 'Debug'));
} else {
if ($clear) {
$content = '';
} else {
$content = $chunk->getContent();
}
}
$content .= $message . "\n";
$chunk->setContent($content);
$chunk->save();
}
}
$msg = print_r($scriptProperties, true);
my_debug($msg, true);
$userFields = $user->toArray();
$msg = "\n *********************** \n" . print_r($userFields, true);
my_debug($msg);
BTW, it occurs to me that the first thing to check is whether OnManagerLogin is firing at all. The plugin code may not be executing, which would explain why it doesn't work.
just spottd the space in the case statement. the event fires allright. but no login yet