We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21301
    • 93 Posts
    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.
      • 32963
      • 1,732 Posts
      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.
        • 21301
        • 93 Posts
        Quote from: xwisdom at Aug 02, 2005, 09:18 AM

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

        Quote from: xwisdom at Aug 02, 2005, 09:18 AM

        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.

        Quote from: xwisdom at Aug 02, 2005, 09:18 AM

        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?
          • 32963
          • 1,732 Posts
          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.
            • 21301
            • 93 Posts
            Quote from: xwisdom at Aug 02, 2005, 12:44 PM

            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.
              • 21301
              • 93 Posts
              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
                  // 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;
              
                • 21301
                • 93 Posts
                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
                    $ds = $modx->db->query($sql);
                    while ($row = $modx->db->getRow($ds)) $dg[$i++]=$row[0];
                


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

                  • 32963
                  • 1,732 Posts
                  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.
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Maybe a difference in MySQL 3.23.x vs. 4.x?
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 32963
                      • 1,732 Posts
                      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.