We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Hi, is it possible for me to check the current user, whether they were login as manager or not? I also want the ability to check the user group, whether they are allowed to modify that page or not.

    I think the best way to figure this out is from quickedit, but if sombody know the quickest way to do it, please reply this forum post, and it will save me a ton of time to figure it out myself.

    Thanks
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
    • It’s very possible and easy. I don’t recall teh API command off the top of my head, but a quick read of document.parser.class.inc.php should reveal the answer.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 32241
        • 1,495 Posts
        Yep,

        I found this $_SESSION[’mgrValidated’].

        The only thing that still concern me is the ability to know, whether that current manager user have access to the page or not. If you can guide me through the file that I need to check, it will be awesome.

        Thanks
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 32241
          • 1,495 Posts
          Somebody has any response to this question?
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 32963
            • 1,732 Posts
            Hi,

            The system will determine whether or not the user has access to the page. See Also $modx->getLoginID()

              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 32241
              • 1,495 Posts
              Quote from: xwisdom at Dec 29, 2005, 03:36 PM

              Hi,

              The system will determine whether or not the user has access to the page. See Also $modx->getLoginID()

              I try that code, but it doesn’t work though.

              What do you mean by the system will detect it automatically? On that function return on on the site session?

              Thanks
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 32963
                • 1,732 Posts
                The core will check whether or not the user has access to the page. This means that nothing on the page is executed or displayed unless the user has access to it.
                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                  • 32241
                  • 1,495 Posts
                  Quote from: xwisdom at Dec 29, 2005, 05:59 PM

                  The core will check whether or not the user has access to the page. This means that nothing on the page is executed or displayed unless the user has access to it.

                  I see what you mean by that.

                  Here is the code that I code to check current document group against current manager user doc group. If they match it will return true, if not than it’s false.

                  	function isMemberOfMgrGroup(){
                  		global $modx;
                  		// Fetch current document groups
                  		$sql = '';
                  		$result = $modx->db->select('document_group', $modx->getFullTableName("document_groups"), 'document = '.$modx->documentIdentifier);
                  		$counter = 0;
                  		while($tempResult = mysql_fetch_array($result)) {
                  			$docGroups[$counter] = $tempResult['document_group'];
                  			$counter++;
                  		}
                  		if(!is_array($docGroups)) return true;
                  		// Fetch current manager groups
                  		$mgrGroups = $_SESSION['mgrDocgroups'];
                  		if(!is_array($docGroups)) return false;
                  		foreach($docGroups as $k=>$v)
                  			if(in_array(trim($v),$mgrGroups)) return true;
                  		return false;
                  	}
                  


                  For checking current web user group against the current web user, there is a built in modx function to do that

                  $modx->isMemberOfWebGroup($WebGroup)
                  


                  $webgroup is an array of group name.
                    Wendy Novianto
                    [font=Verdana]PT DJAMOER Technology Media
                    [font=Verdana]Xituz Media