From a27bc36ea131df3507a802594999b5eec99e8f36 Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 17 Jul 2006 07:56:16 +0000 Subject: [PATCH] Updated acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4174 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_acl.inc | 115 +++++++----------- .../departments/class_departmentGeneric.inc | 33 +++-- plugins/admin/groups/class_groupGeneric.inc | 2 +- .../connectivity/class_connectivity.inc | 2 +- plugins/personal/generic/class_user.inc | 3 +- 5 files changed, 71 insertions(+), 84 deletions(-) diff --git a/include/class_acl.inc b/include/class_acl.inc index 499fcc8cb..637d0ca84 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -98,34 +98,45 @@ class acl extends plugin } else { $oc= $this->attrs['objectClass']; } + + + /* Extract available categories from plugin info list */ foreach ($plist as $class => $acls){ - if (isset($acls['plDescription'])){ - /* Only feed categories */ - if (isset($acls['plDepends']['description'])){ - $this->aclObjects[$acls['plDepends']['objectClass']]= $acls['plDepends']['description']; - } - /* Additionally filter the classes we're interested in in "self edit" mode */ - if (in_array_ics($acls['plDepends']['objectClass'], $oc)){ - $this->myAclObjects[$class]= $acls['plDescription']; + /* Only feed categories */ + if (isset($acls['plCategory'])){ + + /* Walk through supplied list and feed only translated categories */ + foreach($acls['plCategory'] as $idx => $data){ + + /* Non numeric index means -> base object containing more informations */ + if (preg_match('/^[0-9]+$/', $idx)){ + if (!isset($this->ocMapping[$data])){ + $this->ocMapping[$data]= array(); + $this->ocMapping[$data][]= '0'; + } + $this->ocMapping[$data][]= $class; + } else { + if (!isset($this->ocMapping[$idx])){ + $this->ocMapping[$idx]= array(); + $this->ocMapping[$idx][]= '0'; + } + $this->ocMapping[$idx][]= $class; + $this->aclObjects[$idx]= $data['description']; + + /* Additionally filter the classes we're interested in in "self edit" mode */ + if (in_array_ics($data['objectClass'], $oc)){ + $this->myAclObjects[$class]= $acls['plDescription']; + } + } + } } } - /* Add category for all objects */ + /* Sort categories */ asort($this->aclObjects); - /* Generate mapping object */ - foreach ($plist as $oc => $pl){ - if (isset($pl['plDepends']['objectClass'])){ - $class= $pl['plDepends']['objectClass']; - if (!isset($this->ocMapping[$class])){ - $this->ocMapping[$class]= array(); - $this->ocMapping[$class][]= '0'; - } - $this->ocMapping[$class][]= $oc; - } - } /* Fill acl types */ if ($this->isContainer){ @@ -352,19 +363,16 @@ class acl extends plugin $aclList->SetHeight(150); /* Add settings for all categories to the (permanent) list */ - foreach ($this->aclObjects as $oc => $dsc){ + foreach ($this->aclObjects as $section => $dsc){ $summary= ""; - foreach ($plist as $key => $plugin){ - if (isset($plugin['plDepends']['objectClass']) && $plugin['plDepends']['objectClass'] == $oc && - isset($this->aclContents[$key])){ - if (count($this->aclContents[$key]) && isset($this->aclContents[$key][0]) && - $this->aclContents[$key][0] != ""){ - $summary.= "$key, "; - continue; - } - if (!isset($this->aclContents[$key][0]) && count($this->aclContents[$key])){ - $summary.= "$key, "; - } + foreach($this->ocMapping[$section] as $oc){ + if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) && + $this->aclContents[$oc][0] != ""){ + $summary.= "$oc, "; + continue; + } + if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){ + $summary.= "$oc, "; } } @@ -377,8 +385,8 @@ class acl extends plugin $field1= array("string" => $dsc, "attach" => "style='width:100px'"); $field2= array("string" => $summary); - $action= ""; - $action.= ""; + $action= ""; + $action.= ""; $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'"); $aclList->AddEntry(array($field1, $field2, $field3)); } @@ -421,13 +429,12 @@ class acl extends plugin /* Collect objects for selected category */ $aclObjects= array(); - - foreach ($plist as $class => $acls){ - if (isset($acls['plDepends']['objectClass']) && $acls['plDepends']['objectClass'] == $this->aclObject){ - $aclObjects[$class]= $acls['plDescription']; + foreach ($this->ocMapping[$this->aclObject] as $idx => $class){ + if ($idx == 0){ + continue; } + $aclObjects[$class]= $plist[$class]['plDescription']; } - $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects)); } @@ -446,40 +453,12 @@ class acl extends plugin $plist= $tmp->info; asort($plist); - /* Generate global options */ -# $key= "global"; -# $display.= ""; -# -# $spc= "  "; -# if ($this->isContainer && $this->aclType != 'base'){ -# $options= $this->mkchkbx($key."_0_c", _("Create objects"), preg_match('/c/', $currentAcl[0])).$spc; -# $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $currentAcl[0])).$spc; -# $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $currentAcl[0])).$spc; -# if ($plist[$key]['plSelfModify']){ -# $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc; -# } -# } else { -# $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $currentAcl[0])).$spc; -# $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $currentAcl[0])).$spc; -# if ($plist[$key]['plSelfModify']){ -# $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc; -# } -# } -# -# /* Global options */ -# $more_options= $this->mkchkbx($key."_0_r", _("read"), preg_match('/r/', $currentAcl[0])).$spc; -# $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $currentAcl[0])); -# -# $display.= "
"._("All objects of this category")."
$options ".("Complete object:")." $more_options

"; - /* Build general objects */ foreach ($list as $key => $name){ /* Create sub acl if it does not exist */ if (!isset($this->aclContents[$key])){ $this->aclContents[$key]= array(); - } - if (!isset($this->aclContents[$key][0])){ $this->aclContents[$key][0]= ''; } $currentAcl= $this->aclContents[$key]; @@ -512,7 +491,7 @@ class acl extends plugin /* Walk through the list of attributes */ $cnt= 1; - $splist= $plist[$key]; + $splist= $plist[$key]['plProvidedAcls']; asort($splist); foreach($splist as $attr => $dsc){ diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 6e1f962f1..cb42e5d27 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -525,19 +525,26 @@ class department extends plugin /* Return plugin informations for acl handling */ function plInfo() { - return (array("plDescription" => _("Departments"), - "plSelfModify" => FALSE, - "plDepends" => array("objectClass" => "gosaDepartment", "description" => _("Departments")), - "description" => _("Description"), - "c" => _("Country"), - "l" => _("Location"), - "telephoneNumber" => _("Telephone"), - "ou" => _("Department name"), - "businessCategory" => _("Category"), - "st" => _("State"), - "postalAddress" => _("Address"), - "gosaUnitTag" => _("Administrative settings"), - "facsimileTelephoneNumber" => _("Fax"))); + return (array("plShortName" => _("Generic"), + "plDescription" => _("Departments"), + "plSelfModify" => FALSE, + "plPriority" => 0, + "plDepends" => array(), + "plSection" => array("admin"), + "plCategory" => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))), + + "plProvidedAcls" => array( + "description" => _("Description"), + "c" => _("Country"), + "l" => _("Location"), + "telephoneNumber" => _("Telephone"), + "ou" => _("Department name"), + "businessCategory" => _("Category"), + "st" => _("State"), + "postalAddress" => _("Address"), + "gosaUnitTag" => _("Administrative settings"), + "facsimileTelephoneNumber" => _("Fax")) + )); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 33a7a5d51..3159f234b 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -864,7 +864,7 @@ class group extends plugin "plDepends" => array(), "plPriority" => 0, "plSection" => array("admin"), - "plCategory" => array("groups" => _("Groups")), + "plCategory" => array("groups" => array("objectClass" => "posixGroup", "description" => _("Groups"))), "plProvidedAcls" => array( "cn" => _("Name"), diff --git a/plugins/personal/connectivity/class_connectivity.inc b/plugins/personal/connectivity/class_connectivity.inc index fbf45eef1..bd39d628b 100644 --- a/plugins/personal/connectivity/class_connectivity.inc +++ b/plugins/personal/connectivity/class_connectivity.inc @@ -175,7 +175,7 @@ class connectivity extends plugin "plDepends" => array("user"), "plPriority" => 5, // Position in tabs "plSection" => "personal", // This belongs to personal - "plCategory" => array("gosaAccount"), + "plCategory" => array("users"), "plOptions" => array(), "plProvidedAcls" => array( "connectivity" => "!!! FIXME "._("Connectivity account")) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 5f12349d0..700a3aeea 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -1311,7 +1311,8 @@ class user extends plugin "plDepends" => array(), "plPriority" => 0, "plSection" => array("personal" => _("My account")), - "plCategory" => array("gosaAccount" => _("Users")), + "plCategory" => array("users" => array("description" => _("Users"), + "objectClass" => "gosaAccount")), "plProvidedAcls" => array( "userPassword" => _("User password"), -- 2.30.2