Different FrontEnd based on user login
#1
Posted 07 November 2007 - 01:33 PM
I've been setting up my first Etomite site and everything went well until my client requested to have specific pages in the frontend only visible for registered users. As far as I can see, this is not so easy to do with the existing snippets and before diving to much into custom development I wondered if there are already some easy validated solutions out there.
Thanks in advance.
Traxas
#2
Posted 07 November 2007 - 02:11 PM
#3
Posted 07 November 2007 - 02:17 PM
#4
Posted 07 November 2007 - 03:41 PM
I used the authenticate_visitor snippet and can login/ logout and acces (or not if not logged in) the parts of the site I put behind the authentication flags using roles and permissions. The only thing I can not get to work is the snippets to throw out links that are not valid when not loged in I tried building my own authListMenu and horiMenu. I used the following code for horiMenu since that seemed the easiest one:
$childrenOrig = $etomite->getActiveChildren($id); $menu = "";
// throw out all the not authenticated childeren
$counter = 0;
$children = Array();
foreach ($childrenOrig as $childItem)
{
if(
($childItem['authenticate'] && $etomite->checkPermissions($childItem['id'])) || !$childItem['authenticate'] )
{
$children[$counter] = $childItem;
$counter++;
}
}
I do have the flag authenticate on for some of the childeren, but $childItem['authenticate'] always is false.I'm using version 0.6.1.4. Also could you provide me a link to your authListMenu snippet?
Is this the wrong way to test this? Any help is greatly appriciated
TraXas
#5
Posted 07 November 2007 - 06:13 PM
// does this user have permissions to see this document and as a menu option?
// let's check the permissions for this document id
if($etomite->checkPermissions($row['id']))
{
...process this record into a menu item...
}
It's that simple...
#6
Posted 07 November 2007 - 07:47 PM
In my setup I've done the following:
doc 1 --> Flag Authenticate not set, no permissions set
doc 2 --> Flag Authenticate set, permissions set to members_only
user traxas is part of the member group
My intention is to show in the menu when nobody is loged on:
- doc 1
When user traxas is logged on
- doc 1
- doc 2
However when I use the code below, I get for no user no entries and for user traxas only doc 2
// does this user have permissions to see this document and as a menu option?
// let's check the permissions for this document id
if($etomite->checkPermissions($row['id']))
{
...process this record into a menu item...
}
I guess my understanding of this API-function is incorrect: I would expect that it would also return true if the document is visible for everyone.That being said, I guess I'm overseeing something stupid here, but I have no clue what it is.
TraXas.
Edited by TraXas, 07 November 2007 - 07:49 PM.
#7
Posted 08 November 2007 - 11:39 AM
The checkPermissions() function does not check if the flag authenticate is not set and returns FALSE in this case. so I went back to my original code, but the problem was that getActiveChildren() does not load by default the authenticate field. The fix:
$childrenOrig = $etomite->getActiveChildren($id, 'menuindex', 'ASC', 'id, pagetitle, description, parent, alias, longtitle, authenticate');
// throw out all the not authenticated childeren
foreach ($childrenOrig as $childItem)
{
if(($etomite->checkPermissions($childItem['id'])) || (!$childItem['authenticate'] ))
{
$children[] = $childItem;
}
}
TraXas.
#8
Posted 08 November 2007 - 02:19 PM
TraXas, on Nov 8 2007, 06:39 AM, said:
The checkPermissions() function does not check if the flag authenticate is not set and returns FALSE in this case. so I went back to my original code, but the problem was that getActiveChildren() does not load by default the authenticate field.
if(($childItem['authenticate']
&& $etomite->checkPermissions($childItem['id']))
|| !$childItem['authenticate'])
{
#9
Posted 09 November 2007 - 09:43 AM
Ralph, on Nov 8 2007, 03:19 PM, said:
But would it not be better to have the
getActiveChilderen() call by default also returns the authenticate field ( Just a thought)
TraXas.
#10
Posted 09 November 2007 - 02:20 PM
TraXas, on Nov 9 2007, 04:43 AM, said:
But would it not be better to have the
getActiveChilderen() call by default also returns the authenticate field ( Just a thought)
TraXas.
#11
Posted 23 March 2009 - 01:33 AM
I've attached my version. Changes begin on line 156.
Right now I'm getting some interesting output results: 1, R, or 0. I can provide login details, if needed.
Can anyone give me a hand, please?
In ridiculous, I have authentication working in the ListChildorSibs snippet. Don't ask me how!
Attached Files
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












