diff --git a/contrib/fusiondirectory.conf b/contrib/fusiondirectory.conf index b5a5afa291763d0e939f1cce09da3483d6773b8d..c33665d28a4894526a2a6eb82a98f7825211e669 100644 --- a/contrib/fusiondirectory.conf +++ b/contrib/fusiondirectory.conf @@ -31,27 +31,11 @@ <menu> <!-- Section to enable administrative services --> <section name="Administration"> - <plugin acl="department" class="departmentManagement" /> - <plugin acl="users" class="userManagement" /> - <plugin acl="groups" class="groupManagement" /> - <plugin acl="roles" class="roleManagement"/> - <plugin acl="ogroups" class="ogroupManagement" /> - <plugin acl="application" class="applicationManagement" /> - <plugin acl="mimetypes" class="mimetypeManagement" /> - <plugin acl="devices" class="deviceManagement" /> <plugin acl="terminal/termgeneric,workstation/workstationGeneric,server/serverGeneric,phone/phoneGeneric,printer/printgeneric,component/componentGeneric,winworkstation/wingeneric" class="systemManagement" /> <!-- Use 'lockDn' for dn 'lockName' for name 'lockType' for branch/freeze --> <plugin acl="fai/faiScript,fai/faiHook,fai/faiTemplate,fai/faiVariable,fai/faiPartitionTable,fai/faiPackage,fai/faiProfile,fai/faiManagement" class="faiManagement" /> - <plugin acl="netgroup" class="netgroupManagement" /> - <plugin acl="gofaxlist" class="blocklist" /> - <plugin acl="gofonmacro" class="goFonMacro" /> - <plugin acl="gofonconference" class="phoneConferenceManagment" /> - <plugin acl="acl" class="aclManagement" /> - <plugin acl="sudo" class="sudoManagement" /> - <plugin acl="recovery" class="recoveryConfig" /> - <plugin acl="supannStructures" class="supannStructuresManagement" /> </section> <!-- Section to enable addon plugins --> diff --git a/html/index.php b/html/index.php index 55d3d1a881bfbca502eac5a7289ff56f30c33351..ed65f514592b27f358e250f12fdd8c20e7c3ec9f 100644 --- a/html/index.php +++ b/html/index.php @@ -255,15 +255,15 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces } /* Check for schema file presence */ - if ($config->get_cfg_value("schemaCheck") == "TRUE"){ - $recursive = ($config->get_cfg_value("ldapFollowReferrals") == "TRUE"); - $tls = ($config->get_cfg_value("ldapTLS") == "TRUE"); + if ($config->get_cfg_value("schemaCheck") == "TRUE") { + $recursive = ($config->get_cfg_value("ldapFollowReferrals") == "TRUE"); + $tls = ($config->get_cfg_value("ldapTLS") == "TRUE"); if(!count($ldap->get_objectclasses())){ msg_dialog::display(_("LDAP error"), _("Cannot detect information about the installed LDAP schema!"), ERROR_DIALOG); displayLogin(); exit() ; - }else{ + } else { $cfg = array(); $cfg['admin'] = $config->current['ADMINDN']; $cfg['password'] = $config->current['ADMINPASSWORD']; diff --git a/include/class_config.inc b/include/class_config.inc index 192773649ea86ebe86ab6d6c794e2e0a254d7106..9368589250ff6a553a779b9c20584054ebce4200 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -1312,6 +1312,15 @@ class config { $this->data['MENU'][$section][] = $attrs; } } + usort($this->data['SECTIONS'], + function ($a, $b) + { + if ($a['priority'] == $b['priority']) { + return 0; + } + return (($a['priority'] < $b['priority']) ? -1 : 1); + } + ); } } diff --git a/include/class_management.inc b/include/class_management.inc index bb16c3289efd237f7ea307829f8cadf996e1ff13..d51119e6de713159a6b95a503169b34bb39868bd 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -218,16 +218,27 @@ class management */ protected function getHeader() { - if($this->skipHeader) return(""); + if ($this->skipHeader) { + return ""; + } + + if (in_array_ics('plInfo', get_class_methods(get_class($this)))) { + $plInfos = $this->plInfo(); + $plDescription = $plInfos['plDescription']; + $plIcon = $plInfos['plIcon']; + } else { + $plDescription = $this->plDescription; + $plIcon = $this->plIcon; + } - if (get_object_info() != ""){ - $display= print_header(get_template_path($this->plIcon),_($this->plDescription), + if (get_object_info() != "") { + $display = print_header(get_template_path($plIcon), _($plDescription), "<img alt=\"\" class=\"center\" src=\"".get_template_path('images/lists/locked.png')."\">". LDAP::fix(get_object_info())); } else { - $display= print_header(get_template_path($this->plIcon),_($this->plDescription)); + $display = print_header(get_template_path($plIcon), _($plDescription)); } - return($display); + return $display; } diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 51e3ce938a169ab0241478f8ad237a32bc513be4..20cb0913fc4c3fb4e75ce11a241f37f24a1677a2 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -85,6 +85,27 @@ class pluglist { $this->info['all']['plProvidedAcls'] = array(); $this->info['all']['plDescription'] = _("All objects in this category"); $this->info['all']['plSelfModify'] = FALSE; + + uasort($this->info, + function ($a, $b) + { + if (isset($a['plPriority']) && isset($b['plPriority'])) { + if ($a['plPriority'] == $b['plPriority']) { + return 0; + } elseif ($a['plPriority'] < $b['plPriority']) { + return -1; + } else { + return 1; + } + } elseif (isset($a['plPriority'])) { + return -1; + } elseif (isset($b['plPriority'])) { + return 1; + } else { + return 0; + } + } + ); } diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index d58cfa56ddae89ba0469dd0c7384e00cfac7a99d..4997f94bd88d92620430527685e1d58f6334bd9b 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -22,72 +22,82 @@ class aclManagement extends management { - var $plHeadline = "Acl"; - var $plDescription = "Manage access control lists"; - var $plIcon = "plugins/acl/images/plugin.png"; - // Tab definition - protected $tabClass = "aclroletab"; - protected $tabType = "ACLROLETAB"; - protected $aclCategory = "acl"; - protected $aclPlugin = "acl"; + protected $tabClass = "aclroletab"; + protected $tabType = "ACLROLETAB"; + protected $aclCategory = "acl"; + protected $aclPlugin = "acl"; protected $objectName = "acl"; - function __construct(&$config,$ui) + /* Return plugin informations for acl handling */ + static function plInfo() + { + return array( + "plShortName" => _("Acl"), + "plDescription" => _("Access control list management"), + "plIcon" => "plugins/acl/images/plugin.png", + "plSection" => "admin", + "plCategory" => array("acl"), + + "plProvidedAcls" => array() + ); + } + + function __construct(&$config, $ui) { $this->config = $config; - $this->ui = $ui; + $this->ui = $ui; $this->storagePoints = array(get_ou("aclRoleRDN")); // ACLs are attached to department containers // Build filter - if (session::global_is_set(get_class($this)."_filter")){ - $filter= session::global_get(get_class($this)."_filter"); + if (session::global_is_set(get_class($this)."_filter")) { + $filter = session::global_get(get_class($this)."_filter"); } else { - $filter = new filter(get_template_path("acl-filter.xml", true)); + $filter = new filter(get_template_path("acl-filter.xml", TRUE)); $filter->setObjectStorage($this->storagePoints); } $this->setFilter($filter); // Build headpage - $headpage = new listing(get_template_path("acl-list.xml", true)); + $headpage = new listing(get_template_path("acl-list.xml", TRUE)); $headpage->registerElementFilter("filterLabel", "aclManagement::filterLabel"); $headpage->setFilter($filter); // Add copy&paste and snapshot handler. - if ($this->config->boolValueIsTrue("main", "copyPaste")){ + if ($this->config->boolValueIsTrue("main", "copyPaste")) { $this->cpHandler = new CopyPasteHandler($this->config); } - if($this->config->get_cfg_value("enableSnapshots") == "TRUE"){ + if ($this->config->get_cfg_value("enableSnapshots") == "TRUE") { $this->snapHandler = new SnapshotHandler($this->config); } parent::__construct($this->config, $ui, "acl", $headpage); } - function removeEntryConfirmed($action="",$target=array(),$all=array(), - $altTabClass="",$altTabType="",$altAclCategory="") + function removeEntryConfirmed ($action = "", $target = array(), $all = array(), + $altTabClass = "", $altTabType = "", $altAclCategory = "") { - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel confirmed!"); + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removel confirmed!"); $headpage = $this->getHeadpage(); - foreach($this->dns as $key => $dn){ + foreach ($this->dns as $key => $dn) { // Check permissions, are we allowed to remove this object? $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin); - if(preg_match("/d/",$acl)){ + if (preg_match("/d/", $acl)) { - if($headpage->getType($dn) == "gosaRole"){ + if ($headpage->getType($dn) == "gosaRole") { $tabClass = "aclroletab"; $tabType = "ACLROLETAB"; - }else{ + } else { $tabClass = "acltab"; $tabType = "ACLTAB"; } // Delete the object $this->dn = $dn; - $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory, true, true); + $this->tabObject = new $tabClass($this->config, $this->config->data['TABS'][$tabType], $this->dn, $aclCategory, TRUE, TRUE); $this->tabObject->set_acl_base($this->dn); $this->tabObject->delete (); $this->tabObject->parent = &$this; @@ -96,7 +106,7 @@ class aclManagement extends management del_lock($this->dn); } else { msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG); - new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion."); + new log("security", "groups/".get_class($this), $dn, array(), "Tried to trick deletion."); } } @@ -106,59 +116,60 @@ class aclManagement extends management } - function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + function newEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "") { $this->skipFooter = TRUE; - $altTabClass = "aclroletab"; - $altTabType = "ACLROLETAB"; - return(management::newEntry($action,$target,$all,$altTabClass,$altTabType,$altAclCategory)); + $altTabClass = "aclroletab"; + $altTabType = "ACLROLETAB"; + return management::newEntry($action, $target, $all, $altTabClass, $altTabType, $altAclCategory); } - function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + function editEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "") { $this->skipFooter = TRUE; - if(count($target) == 1){ + if (count($target) == 1) { // Set dummy tab object... $this->dn = array_pop($target); $headpage = $this->getHeadpage(); - if($headpage->getType($this->dn) == "gosaRole"){ + if ($headpage->getType($this->dn) == "gosaRole") { $altTabClass = "aclroletab"; $altTabType = "ACLROLETAB"; - }else{ + } else { $altTabClass = "acltab"; $altTabType = "ACLTAB"; } - return(management::editEntry($action,array($this->dn),$all,$altTabClass,$altTabType,$altAclCategory)); + return management::editEntry($action, array($this->dn), $all, $altTabClass, $altTabType, $altAclCategory); } } function detectPostActions() { - $action= management::detectPostActions(); - if(isset($_POST['edit_acl'])) $action['action'] = "edit_acl"; - if(isset($_POST['edit_role'])) $action['action'] = "edit_role"; - return($action); + $action = management::detectPostActions(); + if (isset($_POST['edit_acl'])) { + $action['action'] = "edit_acl"; + } + if (isset($_POST['edit_role'])) { + $action['action'] = "edit_role"; + } + return $action; } // A filter which allows to open a department by clicking on the departments name. - static function filterLabel($row,$dn,$ou= array(),$pid=0,$base="") + static function filterLabel($row, $dn, $ou = array(), $pid = 0, $base = "") { $ou = $ou[0]; - if($dn == $base){ - $ou =" . "; + if ($dn == $base) { + $ou = " . "; } - if(!preg_match("/^cn=/",$dn)){ - $ou.=" ["._("ACL Assignment")."]"; + if (!preg_match("/^cn=/", $dn)) { + $ou .= " ["._("ACL Assignment")."]"; } - $dn= LDAP::fix(func_get_arg(1)); - return("<a href='?plug=".$_GET['plug']."&PID=$pid&act=listing_edit_$row' title='$dn'>$ou</a>"); + $dn = LDAP::fix(func_get_arg(1)); + return "<a href='?plug=".$_GET['plug']."&PID=$pid&act=listing_edit_$row' title='$dn'>$ou</a>"; } - - } -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 2f7fe7aab4b5bbfe02b2427d374cda375395e43f..e32d70457a8ba0416bc95b8c42ea3c08608e4f89 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -22,10 +22,6 @@ class departmentManagement extends management { - var $plHeadline = "Departments"; - var $plDescription = "Manage Departments"; - var $plIcon = "plugins/departments/images/plugin.png"; - // Tab definition protected $tabClass = "deptabs"; protected $tabType = "DEPARTMENTTABS"; @@ -33,6 +29,20 @@ class departmentManagement extends management protected $aclPlugin = "generic"; protected $objectName = "department"; + /* Return plugin informations for acl handling */ + static function plInfo() + { + return array( + "plShortName" => _("Departments"), + "plDescription" => _("Manage departments"), + "plIcon" => "plugins/departments/images/plugin.png", + "plSection" => array("admin" => array("name" => _("Administration"), "priority" => 0)), + "plCategory" => array("department"), + + "plProvidedAcls" => array() + ); + } + function __construct($config,$ui) { $this->config = $config; diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 2cd98a4bb902a2ef3ada5c82c97b287f963d0981..56c8ef00ced3ebf3a09481c793ac39a921a14298 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -22,10 +22,6 @@ class groupManagement extends management { - var $plHeadline = "Groups"; - var $plDescription = "Group administration"; - var $plIcon = "plugins/groups/images/plugin.png"; - // Tab definition protected $tabClass = "grouptabs"; protected $tabType = "GROUPTABS"; @@ -33,6 +29,20 @@ class groupManagement extends management protected $aclPlugin = "group"; protected $objectName = "group"; + /* Return plugin informations for acl handling */ + static function plInfo() + { + return array( + "plShortName" => _("Groups"), + "plDescription" => _("Manage groups"), + "plIcon" => "plugins/groups/images/plugin.png", + "plSection" => "admin", + "plCategory" => array("groups"), + + "plProvidedAcls" => array() + ); + } + function __construct($config,$ui) { $this->config = $config; diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index 9deece55fadce652fe6385311deb2561d3c42257..67217e14251f2a9e09d50c5bba4bb92ceed54f4d 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -22,10 +22,6 @@ class ogroupManagement extends management { - var $plHeadline = "Object groups"; - var $plDescription = "Manage object groups"; - var $plIcon = "plugins/ogroups/images/plugin.png"; - // Tab definition protected $tabClass = "ogrouptabs"; protected $tabType = "OGROUPTABS"; @@ -33,6 +29,20 @@ class ogroupManagement extends management protected $aclPlugin = "ogroup"; protected $objectName = "object group"; + /* Return plugin informations for acl handling */ + static function plInfo() + { + return array( + "plShortName" => _("Object groups"), + "plDescription" => _("Manage object groups"), + "plIcon" => "plugins/ogroups/images/plugin.png", + "plSection" => "admin", + "plCategory" => array("ogroups"), + + "plProvidedAcls" => array() + ); + } + function __construct($config,$ui) { $this->config = $config; diff --git a/plugins/admin/password/class_recoveryConfig.inc b/plugins/admin/password/class_recoveryConfig.inc index 5148e2b5b0a636561f3f6ea28121acf7b551e62c..690e427025b4d8207e6d87e8df25c27bc2cfdbcf 100644 --- a/plugins/admin/password/class_recoveryConfig.inc +++ b/plugins/admin/password/class_recoveryConfig.inc @@ -31,16 +31,17 @@ class recoveryConfig extends simplePlugin /* Return plugin informations for acl handling */ static function plInfo() { - return (array( - "plShortName" => _("Password recovery config"), - "plDescription" => _("Settings for the password recovery feature"), - "plIcon" => "plugins/password/images/password.png", - "plSelfModify" => FALSE, - "plPriority" => 91, - "plCategory" => array("recovery"), + return array( + "plShortName" => _("Password recovery config"), + "plDescription" => _("Settings for the password recovery feature"), + "plIcon" => "plugins/password/images/password.png", + "plSelfModify" => FALSE, + "plPriority" => 91, + "plCategory" => array("recovery"), + "plSection" => "admin", - "plProvidedAcls"=> parent::generatePlProvidedAcls(self::getAttributesInfo()) - )); + "plProvidedAcls"=> parent::generatePlProvidedAcls(self::getAttributesInfo()) + ); } /*! diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 2f4f0abb0ddd082f2508a3f5589d7e229699b2b6..fa4ca5f4927412095e2a7ce6d7661bd61ac9afbc 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -22,10 +22,6 @@ class userManagement extends management { - var $plHeadline = "Users"; - var $plDescription = "Manage users"; - var $plIcon = "plugins/users/images/user.png"; - var $sn = ""; var $givenName = ""; var $uid = ""; @@ -49,6 +45,19 @@ class userManagement extends management protected $passwordChangeForceable = FALSE; protected $enforcePasswordChange = FALSE; + /* Return plugin informations for acl handling */ + static function plInfo() + { + return array( + "plShortName" => _("Users"), + "plDescription" => _("Manage users"), + "plIcon" => "plugins/users/images/user.png", + "plSection" => "admin", + "plCategory" => array("users"), + + "plProvidedAcls" => array() + ); + } function __construct($config,$ui) { diff --git a/plugins/admin/users/main.inc b/plugins/admin/users/main.inc index 6b62924eb30d7e9d726c55fd54c3aab74f735270..b60010503d8542a15d8088bb73533ccf291cfd47 100644 --- a/plugins/admin/users/main.inc +++ b/plugins/admin/users/main.inc @@ -50,5 +50,4 @@ if ( $cleanup ){ session::set('userManagement',$userManagement); } -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>