summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b567045)
raw | patch | inline | side by side (parent: b567045)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Oct 2006 10:57:22 +0000 (10:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Oct 2006 10:57:22 +0000 (10:57 +0000) |
Still missing is create/modify acls
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4947 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4947 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/addons/addressbook/class_addressbook.inc | patch | blob | history |
diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc
index a94b656f85af996028836291e5aae8c997236c7b..bbb57ac20104a970763a310fd1091e2aa5b26195 100644 (file)
var $plHeadline = "Addressbook";
var $plDescription= "This does something";
+ /* Generic */
+ var $ui;
+
/* Phonelist attributes */
var $telephone_list = array();
var $new_dn = "";
"object_type" => "*");
register_global("phonefilter", $phonefilter);
}
+
+ $this->ui = get_userinfo();
}
function execute()
$smarty= get_smarty();
-
-#! Hickert
- /*prevent empty variables for smarty*/
- foreach($this->attributes as $atr) $smarty->assign($atr,"");
+ /* Prevent empty variables for smarty */
+ foreach($this->attributes as $atr) {
+ $smarty->assign($atr,"");
+ }
/* Save formular information */
$phonefilter= get_global("phonefilter");
}
register_global("phonefilter", $phonefilter);
+
/* Perform actions with CTI hook */
if (isset($_GET['target'])
&& isset($_GET['dial'])
unset($_SESSION['target']);
}
+
/* Delete entry? */
if (isset($_POST['delete_entry_confirm'])){
unset($_SESSION['saved_start']);
}
+
/* Delete entry? */
if (isset($_POST['delete_cancel'])){
del_lock ($this->dn);
}
+
/* Save address entry? */
if (isset($_POST['save'])){
$this->save_object();
}
}
+
/* Close info window */
if (isset($_GET['close']) || isset($_POST['cancel'])){
if (isset($_SESSION['saved_start'])){
unset($_SESSION['saved_start']);
}
+
/* Start address book edit mode? */
if (isset($_GET['global'])){
if (!isset($_SESSION['saved_start']) && isset($_GET['start'])){
$_SESSION['show_info']= "ADD";
}
+
/* Open info window */
if (isset($_GET['show'])){
if (!isset($_SESSION['saved_start'])){
$_SESSION['show_info']= base64_decode($_GET['show']);
}
+
/* Get ldap link / build filter */
$ldap= $this->config->get_ldap_link();
$this->telephone_list= array ();
- /* Assemble bases */
+
+ /* Assemble bases
+ (Depending on checkboxes, we search for organisational entries or seperated
+ adressbook entries within dc=adressbook, ) */
$bases= array();
$filter= "";
if ($phonefilter['global'] == "checked"){
if ($phonefilter['organizational'] == "checked"){
$bases[]= $this->search_base;
}
+
+
+ /* Only display those entries that have at least on of this attributes set */
+ $must_have_this = array("telephoneNumber","facsimileTelephoneNumber","mobile","homePhone","mail");
+
+ /* Requested attributes in ldap search */
+ $attributes = array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn");
+
+ /* Create attribute filter part */
+ $attribute_filter = "";
+ foreach($attributes as $att){
+ $attribute_filter .= "(".$att."=".$s.")";
+ }
+
+ /* Walk through bases an check for usable entries */
foreach ($bases as $base){
+
$ldap->cd ($base);
+
if ($phonefilter['object_type'] == '*'){
- $ldap->search ("(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))(!(uid=*$))". //array
- "(|(uid=$s)(homePhone=$s)(telephoneNumber=$s)".
- "(facsimileTelephoneNumber=$s)(mobile=$s)(givenName=$s)(sn=$s)))", array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn"));
+ $ldap->search (
+ "(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))". // Skip templates etc ..
+ "(!(uid=*$))". // Skip entries with ...$ as uid
+ "(|".$attribute_filter."))"
+ ,$attributes);
} else {
$ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))". //array
- "(".$phonefilter['object_type']."=$s))", array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn"));
+ "(".$phonefilter['object_type']."=$s))", $attributes);
}
- /* Build current list, error reporting is off, because many of the
- objects may not be defined after LDAP queries. Asking for presence
- first is too much overhead. */
- error_reporting(0);
-
-
-
-
/* Walk through LDAP results */
while ($attrs= $ldap->fetch()){
$attrs[$atr][0] = "";
}
}
- if(!isset($_GET['start'])) $_GET['start']="";
+ /* Check if page number was posted */
+ if(!isset($_GET['start'])) {
+ $_GET['start']="";
+ }
- /* Only show lines that have set any mail or phone informations */
- if (isset($attrs['telephoneNumber'][0]) ||
- isset($attrs['facsimileTelephoneNumber'][0]) ||
- isset($attrs['mobile'][0]) ||
- isset($attrs['homePhone'][0]) ||
- isset($attrs['mail'][0])){
+ /* Check if at least one attribute is specified */
+ $skip = true;
+ foreach($must_have_this as $attr) {
+ if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
+ $skip =false;
+ break;
+ }
+ }
+ /* Skip all attributes that we are not allowed to read */
+ $any = false;
+ foreach($attributes as $attr){
+ if(!preg_match("/r/",$this->ui->get_permissions($attrs['dn'],"users/user",$attr))){
+ $attrs[$attr][0] = "Not allowed";
+ }else{
+ $any = true;
+ }
+ }
+
+ /* Only show lines that have set any mail or phone informations */
+ if(!$skip && $any){
+
$this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
"<td class=\"phonelist\" title=\"".$attrs['sn'][0].", ".$attrs['givenName'][0]."\" onClick='location.href=\"main.php?plug=".validate($_GET['plug'])."&start=".validate($_GET['start'])."&show=".base64_encode($attrs['dn'])."\"'><a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&start=".validate($_GET['start'])."&show=".base64_encode($attrs['dn'])."\">".$attrs['sn'][0].", ".$attrs['givenName'][0].