Topic: Valid user has no access to restriced document  (Read 2867 times)

Pages: [1]   Go Down

#1: 2-Aug-2005, 07:37 AM


theo
Posts: 93

WWW
I've installed TP3.1 on two servers (RH9 and FC3). Everything works fine except for accessing restricted docuemnts. I can login, change my password by screen/by mail, logout. Log back in again with the new password. All fine, except for documents in a document group to show up when logged in. They don't show in the menu and are not accessible via url. The page doesn't exist for modx. I've switched off caching and tried new installations on two servers. I can login and access pages at a friends installation though.

Here's what I did:
Clean install
System config: enable access permissions, save
New document: Title 'New', [[WebLogin]] and [[WebChangePwd]] in content field, caching off.
New web user: password, full name, email address, save
Web Permissions: add users group 'members', add doc group 'secret', link member group with secret group
Manage webusers: add user to group 'members'
New document: Set title to 'New' and check 'secret' doc group, caching off.

There must be something simple that I miss.
Can I do some checks on the cookies? Session variables? Database fields? Any clues? I'd help a lot if I have some direction on where to start before diggin' into the code.

#2: 2-Aug-2005, 09:18 AM

Emeritus

xwisdom
Posts: 1,732

Quote
Web Permissions: add users group 'members', add doc group 'secret', link member group with secret group

Note you have "members" and "member" groups. Is this a typo?

If Sessions and cookies are working the after logging in you should see the logout link.

Make sure that aliases are unique (should pose a problem thought, but it's good to check)

See this link for more information:
http://www.modxcms.com/why-web-users-and-web-groups.html


xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.

#3: 2-Aug-2005, 10:28 AM


theo
Posts: 93

WWW
Note you have "members" and "member" groups. Is this a typo?
It is, a type indeed.

If Sessions and cookies are working the after logging in you should see the logout link.
They work, also the change password fields show correctly.

Make sure that aliases are unique (should pose a problem thought, but it's good to check)
Do I need any aliasses? Friendly aliases? Don't have any turned on.

How does Modx check if a user is logged in? The javascript for the logout link works but for some reason Modx doesn't know that the user is logged in. Can I check the database to see if this is the case? Which tables to look into?
« Last Edit: 2-Aug-2005, 10:59 AM by theo »

#4: 2-Aug-2005, 12:44 PM

Emeritus

xwisdom
Posts: 1,732

When a user is logged in MODx checks for the $_SESSION['webValidate'] variable

Have a look at the assets/snippets/weblogin/weblogin.processor.inc.php file
xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.

#5: 2-Aug-2005, 04:22 PM


theo
Posts: 93

WWW
When a user is logged in MODx checks for the $_SESSION['webValidate'] variable

Have a look at the assets/snippets/weblogin/weblogin.processor.inc.php file
Ah, thanks! That file contains a lot of interesting code. I'll see if I can solve this strange behaviour.

#6: 3-Aug-2005, 04:45 AM


theo
Posts: 93

WWW
Here's where things go wrong. The query $sql below works well when I feed it to mySql directly. But returns an empty array $dg in the code below. This array has the correct number of elements though. Using implode(",",$dg) results in ",,,,,". Strange. I'll look into the DBAPI more deeply. Anybody seen this behaviour before?

From weblogin.processor.inc.php
Code:
    // get user's document groups
    $dg='';$i=0;
    $tblug = $dbase.".".$table_prefix."web_groups";
    $tbluga = $dbase.".".$table_prefix."webgroup_access";
    $sql = "SELECT uga.documentgroup
            FROM $tblug ug
            INNER JOIN $tbluga uga ON uga.webgroup=ug.webgroup
            WHERE ug.webuser =".$internalKey;

//  $sctest = $dbase.".".$table_prefix."site_content";
//  $sql = "SELECT id FROM $sctest";

    $ds = $modx->db->query($sql);
    while ($row = $modx->db->getRow($ds)) $dg[$i++]=$row[0];

    $_SESSION['webDocgroups'] = $dg;

#7: 3-Aug-2005, 05:02 AM


theo
Posts: 93

WWW
This solves the problem. Adding the parameter "num" to the getRow statement.

Any comments on this?

MySql I'm using:
mysql  Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)

Old
Code:
    $ds = $modx->db->query($sql);
    while ($row = $modx->db->getRow($ds)) $dg[$i++]=$row[0];

New
Code:
    $ds = $modx->db->query($sql);
    while ($row = $modx->db->getRow($ds,"num")) $dg[$i++]=$row[0];

#8: 3-Aug-2005, 09:12 AM

Emeritus

xwisdom
Posts: 1,732

good going theo.

I made the change.

I think that line should have been

while ($row = $modx->db->getRow($ds)) $dg[$i++]=$row['documentgroup'];

but either way works

hmmm, it's very strange that it works ok on other systems. Seems like php behaves differently on some platforms.

xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.

#9: 3-Aug-2005, 09:27 AM

Foundation

rthrash
Posts: 11,282

WWW
Maybe a difference in MySQL 3.23.x vs. 4.x?
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#10: 3-Aug-2005, 09:32 AM

Emeritus

xwisdom
Posts: 1,732

Could be.
xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.

#11: 3-Aug-2005, 10:29 AM

Foundation

rthrash
Posts: 11,282

WWW
I just checked the fix. Amazing what 5 characters can do for you. Outstanding catch, theo... thanks!

(committed to SVN as rev 198)
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#12: 3-Aug-2005, 10:46 AM

Administrator

zi
MODx Special Forces /
Posts: 3,555

May Peace Be On You

WWW
The original question has answered, if you need more info / help, please start new thread.

Thanks,

zi
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.