From: hickert Date: Fri, 3 Nov 2006 05:45:33 +0000 (+0000) Subject: iAdded somne debug output && fixed some user acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8a291b653285691998a0006d9d943d59225240b1;p=gosa.git iAdded somne debug output && fixed some user acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5000 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 642676dc0..359b7f848 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -222,6 +222,10 @@ class plugin */ function execute() { + $_SESSION['errors'] .= "
".get_class($this)." - "; + $_SESSION['errors'] .= "ACL BASE: ".$this->acl_base.""; + $_SESSION['errors'] .= "ACL CAT: ".$this->acl_category."
"; + /* This one is empty currently. Fabian - please fill in the docu code */ $_SESSION['current_class_for_help'] = get_class($this); /* Reset Lock message POST/GET check array, to prevent perg_match errors*/ diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index d118a64c0..6d005b802 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -31,7 +31,6 @@ class userManagement extends plugin /* Dialog attributes */ var $usertab = NULL; var $ui = NULL; - var $acl = ""; var $templates = array(); var $got_uid = false; var $CopyPasteHandler = NULL; @@ -139,7 +138,7 @@ class userManagement extends plugin $this->usertab->current = $s_tab; /* Set ACL and move DN to the headline */ - $this->usertab->set_acl_base(); + $this->usertab->set_acl_base($this->dn); $_SESSION['objectinfo']= $this->dn; } @@ -180,8 +179,7 @@ class userManagement extends plugin /* Load permissions for selected 'dn' and check if we're allowed to remove this 'dn' */ - $ui = get_userinfo(); - if (preg_match("/w/",$ui->get_permissions($this->dn,"users/password"))){ + if (preg_match("/w/",$this->ui->get_permissions($this->dn,"users/password"))){ /* User is allowed to change passwords, save 'dn' and 'acl' for next dialog. */ @@ -203,10 +201,9 @@ class userManagement extends plugin if (isset($_POST['password_finish'])){ /* For security reasons, check if user is allowed to set password again */ - $ui = get_userinfo(); $dn = $this->usertab->dn; - $acl = $ui->get_permissions($dn, "users/password"); - $cacl= $ui->get_permissions($dn, "users/user"); + $acl = $this->ui->get_permissions($dn, "users/password"); + $cacl= $this->ui->get_permissions($dn, "users/user"); if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){ @@ -322,8 +319,7 @@ class userManagement extends plugin /* Some nice guy may send this as POST, so we've to check for the permissions again. */ - $ui = get_userinfo(); - $acl = $ui->get_permissions($this->dn, "users/user"); + $acl = $this->ui->get_permissions($this->dn, "users/user"); if (preg_match('/d/', $acl)){ @@ -430,11 +426,10 @@ class userManagement extends plugin foreach ($this->config->departments as $key => $value){ /* Get acls from different ou's */ - $ui = get_userinfo(); - $acl = $ui->get_permissions("cn=dummy,".$this->DivListUsers->selectedBase,"users/user") ; + $acl = $this->ui->get_permissions("cn=dummy,".get_people_ou().$value,"users/user") ; /* If creation of a new user is allowed, append this template */ - if (preg_match("/r/",$acl)){ + if (preg_match("/c/",$acl)){ /* Search all templates from the current dn */ $ldap->cd (get_people_ou().$value); diff --git a/plugins/admin/users/tabs_user.inc b/plugins/admin/users/tabs_user.inc index b4d52568d..aa0f79221 100644 --- a/plugins/admin/users/tabs_user.inc +++ b/plugins/admin/users/tabs_user.inc @@ -11,7 +11,6 @@ class usertabs extends tabs /* Add references/acls/snapshots */ $this->addSpecialTabs(); - $this->set_acl_base(); } function save_object($save_current= FALSE) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 345c0b79e..95ca9a76b 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -761,7 +761,12 @@ class user extends plugin /* Special handling for attribute jpegPhote needed, scale image via image magick to 147x200 pixels and inject resulting data. */ - if ($this->jpegPhoto != "*removed*"){ + if ($this->jpegPhoto == "*removed*"){ + + /* Reset attribute to avoid writing *removed* as value */ + $this->attrs["jpegPhoto"] = array(); + + } else { /* Fallback if there's no image magick inside PHP */ if (!function_exists("imagick_blob2image")){ @@ -823,10 +828,6 @@ class user extends plugin $this->attrs["jpegPhoto"] = $output; } - } elseif(!$this->is_new) { - // # FIXME User picture saveing ... seams to work. - // This should be set to array in all cases ... else we write *removed* into this attribute ... - $this->attrs["jpegPhoto"] = array(); } /* Build new dn */ @@ -1077,42 +1078,23 @@ class user extends plugin /* Load a jpegPhoto from LDAP, this is going to be simplified later on */ function load_picture() { - /* make connection and read jpegPhoto */ - $ds= ldap_connect($this->config->current['SERVER']); - ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); - if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") { - ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1); - ldap_set_rebind_proc($ds, array(&$this, "rebind")); - } - - if(isset($this->config->current['TLS']) && - $this->config->current['TLS'] == "true"){ - - ldap_start_tls($ds); - } - - $r= ldap_bind($ds); - $sr= @ldap_read($ds, $this->dn, "jpegPhoto=*", array("jpegPhoto")); + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->dn); + $data = $ldap->get_attribute($this->dn,"jpegPhoto"); + + if((!$data) || ($data == "*removed*")){ - /* in case we don't get an entry, load a default picture */ - $this->set_picture ("./images/default.jpg"); - $this->jpegPhoto= "*removed*"; + /* In case we don't get an entry, load a default picture */ + $this->set_picture ();//"./images/default.jpg"); + $this->jpegPhoto= "*removed*"; + }else{ - /* fill data from LDAP */ - if ($sr) { - $ei=ldap_first_entry($ds, $sr); - if ($ei) { - if ($info = ldap_get_values_len($ds, $ei, "jpegPhoto")){ - $this->photoData= $info[0]; - $_SESSION['binary']= $this->photoData; - $_SESSION['binarytype']= "image/jpeg"; - $this->jpegPhoto= ""; - } - } + /* Set picture */ + $this->photoData= $data; + $_SESSION['binary']= $this->photoData; + $_SESSION['binarytype']= "image/jpeg"; + $this->jpegPhoto= ""; } - - /* close conncetion */ - ldap_unbind($ds); }