Code

Added DNS and DHCP enable disable options into setup step 2
[gosa.git] / include / class_userinfo.inc
index 4b2f11b2e2d6ea089e0fb319efc2884c63580ddc..783b66822fe500558313f1ca8a27c726243f02a5 100644 (file)
@@ -69,31 +69,6 @@ class userinfo
 
   function loadACL()
   {
-
-#--------------------------------------------------------------------------OLD-BUT-ACTIVE-----------------------------
-    $ldap= $this->config->get_ldap_link();
-
-    /* Load ACL's from all groups we're in */
-    $this->subtreeACL= array();
-    $ldap->cd($this->config->current['BASE']);
-    if ($this->gidNumber == -1){
-      $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaObject)".
-          "(memberUid=$this->username))");
-    } else {
-      $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaObject)".
-          "(|(memberUid=$this->username)(gidNumber=$this->gidNumber)))");
-    }
-
-    while($attrs = $ldap->fetch()){
-      $base= preg_replace('/^[^,]+,ou=[^,]+,/i', "",$ldap->getDN());
-      $base= preg_replace("/[ ]*,[ ]*/", ",", $base);
-
-      for ($i= 0; $i<$attrs["gosaSubtreeACL"]["count"]; $i++){
-        $this->subtreeACL[$base][]= $attrs["gosaSubtreeACL"][$i];
-      }
-    }
-#echo "NEW ACL LOADING --------------------------------------------------------------------------------------------<br>";
-
     $this->ACL= array();    
     $this->groups= array();    
     $this->result_cache =array();
@@ -122,6 +97,31 @@ class userinfo
       $aclc[$attrs['dn']]= $ol;
     }
 
+    /* Resolve roles here. 
+     */
+    foreach($aclc as $dn => $data){
+      foreach($data as $prio => $aclc_value)  {
+        if($aclc_value['type'] == "role"){
+
+          unset($aclc[$dn][$prio]);
+
+          $ldap->cat($aclc_value['acl'],array("gosaAclTemplate"));
+          $attrs = $ldap->fetch();
+
+          if(isset($attrs['gosaAclTemplate'])){
+            for($i= 0; $i<$attrs['gosaAclTemplate']['count']; $i++){
+              $tmp = @acl::explodeAcl($attrs['gosaAclTemplate'][$i]);  
+
+              foreach($tmp as $new_acl){
+                $new_acl['members'] = $aclc_value['members'];
+                $aclc[$dn][] =$new_acl;
+              }
+            }      
+          }
+        }
+      }
+    }
+
     /* ACL's read, sort for tree depth */
     asort($aclp);
 
@@ -159,7 +159,6 @@ class userinfo
       }
 
     }
-
   }
 
 
@@ -208,6 +207,11 @@ class userinfo
             continue;
           }
 
+          if($subacl['type'] == "role") {
+            echo "role skipped";
+            continue;
+          }
+
           /* Per attribute ACL? */
           if (isset($subacl['acl'][$object][$attribute])){
             $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attribute]);
@@ -282,6 +286,11 @@ class userinfo
       }
     }
 
+    /* Load departments here, if we are using php4 */
+    if(is_php4() && !count($this->config->departments)){
+      $this->config->get_departments();
+    }
+
     /* For all gosaDepartments */
     foreach ($this->config->departments as $dn){
       $acl= array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
@@ -312,6 +321,11 @@ class userinfo
               $acl= $this->cleanACL($acl, TRUE);
               continue;
             }
+    
+            if($subacl['type'] == 'role'){
+              echo "role skipped";
+              continue;
+            }
 
             /* Per object ACL? */
             foreach ($objects as $object){