summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75ad5dd)
raw | patch | inline | side by side (parent: 75ad5dd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 18 Jul 2008 11:18:08 +0000 (11:18 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 18 Jul 2008 11:18:08 +0000 (11:18 +0000) |
- Inherit objects correctly.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11711 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11711 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiHook.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/class_faiVariable.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc
index 6dbbf3ad326ce2b2f363e0f5f653273b1265d8a5..88683616057caae6e929838818c914b8bd850dfa 100644 (file)
*/
if($dn != "new"){
$this->dn =$dn;
-
+
/* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
*/
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
- $attrs_to_search = $this->subAttributes;
- $attrs_to_search[] = "FAIstate";
- $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", $attrs_to_search);
-
- $data = array();
- while($object = $ldap->fetch()){
- $data[] = $object;
- }
- foreach($data as $object){
-
- /* Skip objects, that are tagged as removed */
- if(isset($object['FAIstate'][0])){
- if(preg_match("/removed$/",$object['FAIstate'][0])){
- continue;
- }
- }
-
- /* Set status for save management */
+ $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+ foreach($res as $obj){
$objects = array();
$objects['status'] = "FreshLoaded";
- $objects['dn'] = $object['dn'];
+ $objects['dn'] = $obj['dn'];
$objects = $this->get_object_attributes($objects,$this->subAttributes);
$this->SubObjects[$objects['cn']] = $objects;
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc
index 22fa65001b429606d7e824f705a9292b3442b9f6..8380d5a7bf790bb18a9e2e5e2e6f70ac7dc30546 100644 (file)
/* Attributes to initialise for each subObject */
var $subAttributes = array("cn","description","FAIvariableContent");
var $sub64coded = array();
+ var $subBinary = array();
/* Specific attributes */
var $cn = ""; // The class name for this object
/* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
*/
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
-
- $attrs_to_search = $this->subAttributes;
- $attrs_to_search[] = "FAIstate";
- $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
- while($object = $ldap->fetch()){
-
- /* Skip objects, that are tagged as removed */
- if(isset($object['FAIstate'][0])){
- if(preg_match("/removed$/",$object['FAIstate'][0])){
- continue;
- }
- }
-
- /* Set status for save management */
- foreach($this->subAttributes as $attrs){
- if(!isset($object[$attrs][0])){
- $this->SubObjects[$object['cn'][0]][$attrs]="";
- }else{
- $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
- }
- }
-
- foreach($this->sub64coded as $codeIt){
- $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
- }
-
- $this->SubObjects[$object['cn'][0]]['status'] = "edited";
- $this->SubObjects[$object['cn'][0]]['dn'] = $object['dn'];
+ $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+ foreach($res as $obj){
+ $objects = array();
+ $objects['status'] = "FreshLoaded";
+ $objects['dn'] = $obj['dn'];
+ $objects = $this->get_object_attributes($objects,$this->subAttributes);
+ $this->SubObjects[$objects['cn']] = $objects;
}
-
}
$this->is_new = FALSE;
if($this->dn == "new"){
$this->cn = get_post('cn');
}
}
+
+ /* Reload some attributes */
+ function get_object_attributes($object,$attributes)
+ {
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->cat($object['dn'],$attributes);
+ $tmp = $ldap->fetch();
+
+ foreach($attributes as $attrs){
+ if(isset($tmp[$attrs][0])){
+ $var = $tmp[$attrs][0];
+
+ /* Check if we must decode some attributes */
+ if(in_array_ics($attrs,$this->sub64coded)){
+ $var = base64_decode($var);
+ }
+
+ /* check if this is a binary entry */
+ if(in_array_ics($attrs,$this->subBinary)){
+ $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
+ }
+
+ /* Fix slashes */
+ $var = addslashes($var);
+ $object[$attrs] = $var;
+ }
+ }
+ return($object);
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: