We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32982
    • 674 Posts
    This is an auto-generated support/comment thread for Inherit Parent Permissions.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    A code to inherit the parent permissions from parent document
      Jabiertxof (formerly XYZVISUAL)
      My bussines: http://marker.es
      https://www.youtube.com/user/jabiertxof/videos
      • 18338
      • 31 Posts
      Is anyone using this package in 1.0.2 or later? Seems like a handy feature to have on a site where I am adding many new users, but I’m a little taken aback by the lack of comments or reviews.
        • 25663 MODX Staff
        • 12,272 Posts
        It’s for Resources (web pages) not users, or am I misunderstanding your intended use. I suspect it would just work, and it would take less than 5 minutes to test to find out.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 18338
          • 31 Posts
          Revisiting my post I can see why it was unclear -- I am interested in having inherited access permissions for resources *because* of the number of new users who would otherwise have to figure out an aspect of the manager not otherwise relevant. For what it’s worth, this feature would be right up there with having resources inherit the template of their parent in terms of usefulness in our use case. It’s subtle, but takes some of the confusion out of learning modx.

          I’ll give Inherit Parent Permissions a go sometime soon and try to post my results in this thread.
            • 25663 MODX Staff
            • 12,272 Posts
            Quote from: Mark at May 06, 2010, 07:21 AM
            For what it’s worth, this feature would be right up there with having resources inherit the template of their parent in terms of usefulness in our use case. It’s subtle, but takes some of the confusion out of learning modx.

            For what it’s worth, I completely agree.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 18338
              • 31 Posts
              Added this plugin to a 1.0.2 installation and at the moment it seems to be creating duplicates of the resource group of the parent each time a new resource is created. I’m not particularly adept at the MODx API, but I’ll take a look and see if there’s anything obvious going on.
                • 18338
                • 31 Posts
                I have attached a screenshot that demonstrates the issue. I’m not sure that it’s as much that the resource group is being duplicated but rather that duplicate entries are appearing in the "Access Permissions" tab of resources that have been created since I added the plugin. The first subpage I created in this section after adding the plugin has two duplicate entries and the second, which is featured in the screenshot, has three duplicate entries. Note also how they are all three checked.

                I’m not sure I’m going to be able to take this much farther, but if anyone’s browsing through this thread and might have an idea, here’s the code for Inherit Parent Permissions -- it’s a very simple add-on. I’m just not up enough on MODx internals and SQL to spot the issue here:

                /*
                * Inherit Parent Permissions
                * Javier Arraiza // www.marker.es // 24/3/2008
                * Based in
                * Inherit Template from Parent
                * Written By Raymond Irving - 12 Oct 2006
                *
                * A code to inherit the parent permissions from parent document
                *
                * Configuration:
                * check the OnDocFormSave event
                *
                * Version 1.1
                *
                */
                
                global $content;
                $e = &$modx->Event;
                
                switch($e->name) {
                case 'OnDocFormSave':
                	if($_REQUEST['parent'] > 0 && $_POST['mode']==4) {
                		$table=$modx->getFullTableName('document_groups');
                		$table2=$modx->getFullTableName('site_content');
                		$sql='SELECT document_group FROM '.$table.' WHERE document='.$_REQUEST['parent'];
                		$sql_query1=$modx->dbQuery($sql);
                		while($row=mysql_fetch_array($sql_query1)){
                			$result=$row['document_group'];
                			if ($sql_query1!=""){
                				$sql='INSERT INTO '.$table.' (document,document_group) VALUES ((SELECT id FROM '.$table2.' ORDER BY id DESC LIMIT 1),'.$result.')';  
                				$modx->dbQuery($sql);
                			}
                		}
                	}
                	break;
                
                default:
                	return;
                	break;
                }