X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions.inc;h=286e0a18bb275dd5acbdd2c38405338ada99a816;hb=01f642762ae65b3e4fee377c5a95ea9a901b389c;hp=e3254ed350608a960fe680f3845b36bf2da280fd;hpb=debae573752557eb5a0d09189ff40eca92c3735b;p=gosa.git
diff --git a/include/functions.inc b/include/functions.inc
index e3254ed35..286e0a18b 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -735,93 +735,17 @@ function getMenuCache()
}
-function get_permissions ($dn, $subtreeACL)
+function get_permissions ()
{
- global $config;
-echo "get_permissions() - to be removed
";
-
- $base= $config->current['BASE'];
- $tmp= "d,".$dn;
- $sacl= array();
-
- /* Sort subacl's for lenght to simplify matching
- for subtrees */
- foreach ($subtreeACL as $key => $value){
- $sacl[$key]= strlen($key);
- }
- arsort ($sacl);
- reset ($sacl);
-
- /* Successively remove leading parts of the dn's until
- it doesn't contain commas anymore */
- $tmp_dn= preg_replace('/\\\\,/', '', $tmp);
- while (preg_match('/,/', $tmp_dn)){
- $tmp_dn= ltrim(strstr($tmp_dn, ","), ",");
- $tmp= preg_replace('/\/', '\\,', $tmp);
-
- /* Check for acl that may apply */
- foreach ($sacl as $key => $value){
- if (preg_match("/$key$/", $tmp)){
- return ($subtreeACL[$key]);
- }
- }
- }
-
+ /* Look for attribute in ACL */
+ trigger_error("Don't use get_permissions() its obsolete. Use userinfo::get_permissions() instead.");
return array("");
}
-function get_module_permission($acl_array, $module, $dn)
+function get_module_permission()
{
- global $ui;
-echo "get_module_permissions() - to be removed
";
-
- $final= "";
- foreach($acl_array as $acl){
-
- /* Check for selfflag (!) in ACL to determine if
- the user is allowed to change parts of his/her
- own account */
- if (preg_match("/^!/", $acl)){
- if ($dn != "" && $dn != $ui->dn){
-
- /* No match for own DN, give up on this ACL */
- continue;
-
- } else {
-
- /* Matches own DN, remove the selfflag */
- $acl= preg_replace("/^!/", "", $acl);
-
- }
- }
-
- /* Remove leading garbage */
- $acl= preg_replace("/^:/", "", $acl);
-
- /* Discover if we've access to the submodule by comparing
- all allowed submodules specified in the ACL */
- $tmp= split(",", $acl);
- foreach ($tmp as $mod){
- if (preg_match("/^$module#/", $mod)){
- $final= strstr($mod, "#")."#";
- continue;
- }
- if (preg_match("/[^#]$module$/", $mod)){
- return ("#all#");
- }
- if (preg_match("/^all$/", $mod)){
- return ("#all#");
- }
- }
- }
-
- /* Return assembled ACL, or none */
- if ($final != ""){
- return (preg_replace('/##/', '#', $final));
- }
-
- /* Nothing matches - disable access for this object */
+ trigger_error("Don't use get_module_permission() its obsolete.");
return ("#none#");
}
@@ -931,16 +855,11 @@ function get_base_from_people($dn)
}
-function chkacl($acl, $name)
+function chkacl()
{
- echo "chkacl - to be removed
";
/* Look for attribute in ACL */
- if (preg_match("/#$name#/", $acl) || $acl == "#all#"){
- return ("");
- }
-
- /* Optically disable html object for no match */
- return (" disabled ");
+ trigger_error("Don't use chkacl() its obsolete. Use userinfo::getacl() instead.");
+ return("-deprecated-");
}
@@ -2194,6 +2113,7 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false)
$Diff = ldap_explode_dn($dn,0);
/* Lets start */
+ $called = false;
while(preg_match("/,/",$dn) && $next && $cnt < $max){
$cnt ++;
@@ -2203,6 +2123,8 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false)
$object = preg_replace("/[,].*$/","",$dn);
$dn = preg_replace("/^[^,]+,/","",$dn);
+ $called = true;
+
/* Check if current dn is valid */
if($ldap!=NULL){
$ldap->cd($dn);
@@ -2220,7 +2142,10 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false)
}
/* Append the rest */
- $ret[] = $keep.$dn;
+ $test = $keep.$dn;
+ if($called && !empty($test)){
+ $ret[] = $keep.$dn;
+ }
$ret['count'] = count($ret) - 1;
$diff = array_diff($ret,$Diff);