Code

Updated dyngroup handling for ogroups
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Jul 2011 07:38:59 +0000 (07:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Jul 2011 07:38:59 +0000 (07:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20930 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/ogroups/class_ogroup.inc
gosa-core/plugins/admin/ogroups/generic.tpl

index b4e75fccbab7d07519ad52b4121bbecd1e048918..cf60da6fd3e2aa29991b703ca1a8700487f2c650 100644 (file)
@@ -66,7 +66,7 @@ class ogroup extends plugin
     var $view_logged = FALSE;
 
     var $copyMembers = TRUE;
-
+    var $wasDyGroup = FALSE;
     var $baseSelector;
 
     /* Already assigned Workstations. Will be hidden in selection. 
@@ -361,6 +361,17 @@ class ogroup extends plugin
             $data[$key] = $dn;
             $lData[$key] = array('data'=> array(image($image),$name));
         }
+
+        if($this->isRestrictedByDynGroup()){
+            $this->memberListing->setDeleteable(false);
+            $smarty->assign("memberACL", preg_replace("/[^r]/", "", $this->getacl("member")));
+            $smarty->assign("isRestrictedByDynGroup", TRUE);
+            
+        }else{
+            $this->memberListing->setDeleteable(true);
+            $smarty->assign("isRestrictedByDynGroup", FALSE);
+        }
+
         $this->memberListing->setListData($data,$lData);
         $this->memberListing->update();
         $smarty->assign("memberList",$this->memberListing->render());
@@ -374,6 +385,17 @@ class ogroup extends plugin
     }
 
 
+    function isRestrictedByDynGroup()
+    {
+        $bool = FALSE;
+        if(isset($this->parent->by_object['DynamicLdapGroup'])){
+            $bool = $this->parent->by_object['DynamicLdapGroup']->isAttributeDynamic('member');
+        }
+        $this->wasDyGroup |= $bool;
+        return($bool);
+    }
+
+
     function set_acl_base($base)
     {
         plugin::set_acl_base($base);
@@ -710,9 +732,11 @@ class ogroup extends plugin
         plugin::save();
 
         /* Move members to target array */
-        $this->attrs['member'] =array();
-        foreach ($this->member as $key => $desc){
-            $this->attrs['member'][]= LDAP::fix($key);
+        if(!$this->wasDyGroup && !$this->isRestrictedByDynGroup()){
+            $this->attrs['member'] =array();
+            foreach ($this->member as $key => $desc){
+                $this->attrs['member'][]= LDAP::fix($key);
+            }
         }
 
         $ldap= $this->config->get_ldap_link();
index 34b4d8c2a093a4a023097f0092f14cd49b1c5908..e99cc8ac039b7e28429582de62ade2b08aedfce1 100644 (file)
     {$trustModeDialog}
   </td>
   <td style='padding-left:10px;' class='left-border'>
+   {if $isRestrictedByDynGroup}
+   <b>{t}The group members are part of a dyn-group and cannot be managed!{/t}</b>
+    <br>
+    <br>
+    {/if}
 
    <b><LABEL for="members">{t}Member objects{/t}</LABEL></b>&nbsp;({$combinedObjects})
    <br>
 {render acl=$memberACL}
    {$memberList}
 {/render}
+{if !$isRestrictedByDynGroup}
 {render acl=$memberACL}
    <button type='submit' name='edit_membership'>{msgPool type=addButton}</button>&nbsp;
 {/render}
+{/if}
   </td>
  </tr>
 </table>