From 2dd52483fce82982d612f68167aefd732af96618 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Dec 2006 12:27:57 +0000 Subject: [PATCH] Added Regex git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5382 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/acl/class_aclManagement.inc | 12 ++++++++++-- plugins/admin/acl/class_divListACL.inc | 9 +-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index 3d3c5ca1f..9d96d40d1 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -324,7 +324,7 @@ class aclManagement extends plugin $Attrs = array("ou","gosaAclEntry","objectClass"); $res = $tmp = array(); // Will contain temporary results $ldap = $this->config->get_ldap_link(); - $Filter = "(&(objectClass=gosaACL)(gosaAclEntry=*))"; + $Filter = "(&(objectClass=gosaACL)(gosaAclEntry=*)(|(cn=".$Regex.")(ou=".$Regex.")))"; /* Fetch following structures, this will be used if !$SubSearch */ $fetch_this = array( @@ -355,7 +355,15 @@ class aclManagement extends plugin $tmp = get_list($Filter, "acl", $fetch_base, $Attrs, $Flags); }else{ $ldap->cat($fetch_base,$Attrs); - $tmp = array($ldap->fetch()); + if($ldap->count()) { + $attrs = $ldap->fetch(); + $re2 = preg_replace("/\*/",".*",$Regex); + if( (isset($attrs['cn'][0]) && preg_match("/".$re2."/i",$attrs['cn'][0])) + |(isset($attrs['ou'][0]) && preg_match("/".$re2."/i",$attrs['ou'][0]))){ + + $tmp = array($attrs); + } + } } $res = array_merge($res,$tmp); } diff --git a/plugins/admin/acl/class_divListACL.inc b/plugins/admin/acl/class_divListACL.inc index dbfe2434d..f61378f6f 100644 --- a/plugins/admin/acl/class_divListACL.inc +++ b/plugins/admin/acl/class_divListACL.inc @@ -53,12 +53,11 @@ class divListACL extends MultiSelectWindow $this->set_filter_objectclasses(); /* Add SubSearch checkbox */ - $this->AddCheckBox(SEPERATOR); $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false); /* Name ,Text ,Default , Connect with alphabet */ - $this->AddRegex ("Regex", _("Display acls matching"),"Not implemented yet" , true); + $this->AddRegex ("Regex", _("Display acls matching"),"*" , true); } @@ -163,13 +162,7 @@ class divListACL extends MultiSelectWindow /* Add some additional checkboxes to the filter part, this should be generated dynamically. */ function set_filter_objectclasses() { - #FIXME This should be created dynamically - $this->gosaAccount = true; - $this->AddCheckBox("gosaAccount", _("Select to display users"), _("Display user") , true); - $this->gosaDepartment = true; - $this->AddCheckBox("gosaDepartment", _("Select to display departments"), _("Display departments"), true); } - /* Return objectClass names used in filter part */ function get_filter_objectclasses() -- 2.30.2