From: hickert Date: Tue, 8 Apr 2008 07:21:21 +0000 (+0000) Subject: Updated sudo X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=73bb93981d3601ad348ac5678cafec54ebb6f275;p=gosa.git Updated sudo -Allow to create a default entry git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10267 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc index fa135f120..d0de10f6f 100644 --- a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc +++ b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc @@ -107,6 +107,7 @@ class divListSudo extends MultiSelectWindow /* Append create options */ if(preg_match("/c/",$acl)) { $s.= "...| "._("Role")."|new_role|\n"; + $s.= "...| "._("Default")."|new_default|\n"; } /* Append multiple remove */ diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc index 7af22e569..ffccd2576 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc @@ -35,9 +35,10 @@ class sudo extends plugin var $sudoHost = array("ALL"); var $sudoRunAs = array("ALL"); - var $accessTo = array(); - var $trustModel = ""; - var $show_ws_dialog = FALSE; + var $accessTo = array(); + var $trustModel = ""; + var $show_ws_dialog = FALSE; + var $was_trust_account= FALSE; var $objectclasses = array("top","sudoRole"); var $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel"); @@ -411,6 +412,10 @@ class sudo extends plugin function save_object() { plugin::save_object(); + + if($this->is_default){ + $this->cn = "default"; + } if(is_object($this->dialog)){ $this->dialog->save_object(); @@ -510,6 +515,11 @@ class sudo extends plugin $message[] = msgPool::required(_("Name")); } + /* Check if name is reserved */ + if(!$this->is_default && preg_match("/^default$/i",$this->cn)){ + $message[] = msgPool::reserved(_("Name")); + } + /* Check name */ if(!preg_match("/^[a-z]*$/i",$this->cn)){ $message[] = msgPool::invalid(_("Name"),$this->cn,"/[a-z]/i"); @@ -593,6 +603,13 @@ class sudo extends plugin } + public function set_default($state) + { + $this->is_default = TRUE; + $this->cn = "default"; + } + + /*! \brief Add ACL object @return Returns the ACL object. */ diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc b/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc index 47fd657a7..9571c7ed0 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc @@ -87,7 +87,7 @@ class sudoManagement extends plugin } } - if(isset($_POST['menu_action']) && in_array($_POST['menu_action'],array("new_role","del_role"))){ + if(isset($_POST['menu_action']) && in_array($_POST['menu_action'],array("new_role","del_role","new_default"))){ $s_action = $_POST['menu_action']; } @@ -99,7 +99,7 @@ class sudoManagement extends plugin ********************/ /* New sudo? */ - if ($s_action=="new_role"){ + if ($s_action=="new_role" || $s_action == "new_default"){ /* Check create permissions */ $acl = $this->ui->get_permissions($this->base,"sudo/sudo"); @@ -114,6 +114,11 @@ class sudoManagement extends plugin /* Set up the sudo ACL's for this 'dn' */ $this->sudotabs->set_acl_base($this->base); + + /* This entry will become the default entry */ + if($s_action == "new_default"){ + $this->sudotabs->set_default(TRUE); + } } } diff --git a/gosa-plugins/sudo/admin/sudo/generic.tpl b/gosa-plugins/sudo/admin/sudo/generic.tpl index d43757612..7fda69f48 100644 --- a/gosa-plugins/sudo/admin/sudo/generic.tpl +++ b/gosa-plugins/sudo/admin/sudo/generic.tpl @@ -7,9 +7,7 @@ {t}Name{/t} - {render acl=$cnACL} - - {/render} + diff --git a/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc b/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc index 0e0c1267c..666fb4c71 100644 --- a/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc +++ b/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc @@ -28,6 +28,13 @@ class sudotabs extends tabs $this->addSpecialTabs(); } + function set_default($state) + { + if(isset($this->by_object['sudo'])){ + $this->by_object['sudo']->set_default($state); + } + } + function save($ignore_account= FALSE) { $baseobject= $this->by_object['sudo'];