From 5d35094663a14290dc22c8520501f75889aeff5b Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 9 Apr 2008 07:53:05 +0000 Subject: [PATCH] Updated sudo stuff. -PHP5 OO git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10291 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../sudo/admin/sudo/class_divListSudo.inc | 13 +++--- .../sudo/admin/sudo/class_sudoGeneric.inc | 42 +++++++++++-------- .../sudo/admin/sudo/class_sudoOption.inc | 8 ++-- .../admin/sudo/class_target_list_systems.inc | 23 +++++----- .../admin/sudo/class_target_list_users.inc | 23 +++++----- gosa-plugins/sudo/admin/sudo/tabs_sudo.inc | 2 +- 6 files changed, 56 insertions(+), 55 deletions(-) diff --git a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc index 05a00306e..3a33cec20 100644 --- a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc +++ b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc @@ -28,17 +28,16 @@ class divListSudo extends MultiSelectWindow { /* Current base */ - var $selectedBase = ""; - var $departments = array(); + private $departments = array(); /* Regex */ - var $Regex = "*"; - var $UserRegex = "*"; + public $Regex = "*"; + public $UserRegex = "*"; /* Subsearch checkbox */ - var $SubSearch = FALSE; - var $parent ; - var $ui ; + public $SubSearch = FALSE; + protected $parent ; + public $ui ; /*! \brief Initialize this class diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc index 1b044fa18..ba8c9e97c 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc @@ -26,26 +26,25 @@ */ class sudo extends plugin { - /* Group attributes */ - var $cn= ""; - var $description= ""; - var $sudoUser = array("ALL"); - var $sudoCommand= array(); - var $sudoHost = array("ALL"); - var $sudoRunAs = array("ALL"); + protected $cn= ""; + protected $description= ""; - var $accessTo = array(); - var $trustModel = ""; - var $show_ws_dialog = FALSE; - var $was_trust_account= FALSE; + protected $sudoUser = array("ALL"); + protected $sudoCommand= array(); + protected $sudoHost = array("ALL"); + protected $sudoRunAs = array("ALL"); + protected $accessTo = array(); + protected $trustModel = ""; - var $objectclasses = array("top","sudoRole"); - var $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel"); + private $is_default = FALSE; + private $show_ws_dialog = FALSE; + private $was_trust_account= FALSE; - var $is_account = TRUE; - var $is_default = FALSE; - var $dialog; + public $objectclasses = array("top","sudoRole"); + public $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel"); + + public $ignore_account = TRUE; /*! \brief Returns to the base department for sudo roles. This department is then used to store new roles. @@ -97,7 +96,7 @@ class sudo extends plugin } /* Is this account a trustAccount? */ - if ($this->is_account && isset($this->attrs['trustModel'])){ + if (isset($this->attrs['trustModel'])){ $this->trustModel= $this->attrs['trustModel'][0]; $this->was_trust_account= TRUE; } else { @@ -106,7 +105,7 @@ class sudo extends plugin } $this->accessTo = array(); - if ($this->is_account && isset($this->attrs['accessTo'])){ + if (isset($this->attrs['accessTo'])){ for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){ $tmp= $this->attrs['accessTo'][$i]; $this->accessTo[$tmp]= $tmp; @@ -528,6 +527,7 @@ class sudo extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); + if($this->is_new){ $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); @@ -739,6 +739,12 @@ class sudo extends plugin } + public function get_cn() + { + return($this->cn); + } + + /*! \brief Used for copy & paste. Some entries must be renamed to avaoid duplicate entries. */ diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoOption.inc b/gosa-plugins/sudo/admin/sudo/class_sudoOption.inc index bbd9c1880..5be32494a 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoOption.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoOption.inc @@ -27,10 +27,10 @@ class sudoOption extends plugin { /* Group attributes */ - var $sudoOption = array(); - var $attributes = array("sudoOption"); - var $is_account = TRUE; - var $options = array(); + protected $sudoOption = array(); + public $attributes = array("sudoOption"); + private $options = array(); + public $ignore_account = TRUE; /*! \brief Initializes this class @param Object $config The GOsa configuration object. diff --git a/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc b/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc index e46b946f8..247c50165 100644 --- a/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc +++ b/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc @@ -22,27 +22,26 @@ class target_list_systems extends MultiSelectWindow { - var $config; - var $list =array(); - var $Targets_used =array(); + public $config; + protected $list =array(); + private $Targets_used =array(); /* Current base */ - var $selectedBase = ""; - var $departments = array(); + private $departments = array(); /* Regex */ - var $Regex = "*"; + protected $Regex = "*"; /* CheckBoxes, to change default values modify $this->AddCheckBox */ - var $servers ; - var $workstations ; - var $terminals ; + protected $servers ; + protected $workstations ; + protected $terminals ; /* Subsearch checkbox */ - var $SubSearch ; - var $parent ; - var $ui ; + protected $SubSearch ; + protected $parent ; + public $ui ; function target_list_systems(&$config,$Targets_used) diff --git a/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc b/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc index 34cc1e810..a3ced3292 100644 --- a/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc +++ b/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc @@ -22,25 +22,24 @@ class target_list_users extends MultiSelectWindow { - var $config; - var $list =array(); - var $Targets_used =array(); + public $config; + private $list =array(); + private $Targets_used =array(); /* Current base */ - var $selectedBase = ""; - var $departments = array(); + private $departments = array(); /* Regex */ - var $Regex = "*"; + protected $Regex = "*"; /* CheckBoxes, to change default values modify $this->AddCheckBox */ - var $user ; - var $group ; + protected $user ; + protected $group ; /* Subsearch checkbox */ - var $SubSearch ; - var $parent ; - var $ui ; + protected $SubSearch ; + protected $parent ; + protected $ui ; function target_list_users(&$config,$Targets_used) { @@ -242,8 +241,6 @@ class target_list_users extends MultiSelectWindow array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH)); } }else{ - $res= get_list($filter, array("users"), get_people_ou().$base, - array("cn","uid","objectClass","description"), GL_SIZELIMIT ); $res = array(); if($this->user){ $filter = "(&(objectClass=person)(objectClass=gosaAccount))"; diff --git a/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc b/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc index 666fb4c71..34aa4cafc 100644 --- a/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc +++ b/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc @@ -41,7 +41,7 @@ class sudotabs extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ - $new_dn= 'cn='.$baseobject->cn.','.sudo::get_sudoers_ou($baseobject->config); + $new_dn= 'cn='.$baseobject->get_cn().','.sudo::get_sudoers_ou($baseobject->config); /* Move group? */ if ($this->dn != $new_dn){ -- 2.30.2