From: hickert Date: Tue, 8 Apr 2008 07:13:43 +0000 (+0000) Subject: Updated sudo X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e1150967624fbefe0b60252821936203e61b6812;p=gosa.git Updated sudo -DSpecial handling for default entries git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10266 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 a02d5a24c..fa135f120 100644 --- a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc +++ b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc @@ -167,6 +167,12 @@ class divListSudo extends MultiSelectWindow } $display = $val['cn'][0].$desc; + + /* Highlight default entry */ + if(preg_match("/^default$/i",$val['cn'][0])){ + $display = "$display"; + } + $field1 = array("string" => "" , "attach" => "style='width:20px;'"); $field2 = array("string" => sprintf($userimg,$val['dn']), diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc index 807315c95..7af22e569 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc @@ -43,7 +43,7 @@ class sudo extends plugin var $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel"); var $is_account = TRUE; - + var $is_default = FALSE; var $dialog; /*! \brief Returns to the base department for sudo roles. @@ -114,6 +114,10 @@ class sudo extends plugin } + if(preg_match("/^default$/i",$this->cn)){ + $this->is_default = TRUE; + } + /* Get global filter config */ if (!session::is_set("sysfilter")){ $ui= get_userinfo(); @@ -318,6 +322,7 @@ class sudo extends plugin *********************/ $smarty = get_smarty(); + $smarty->assign("is_default",$this->is_default); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); $smarty->assign($attr."ACL",$this->getacl($attr)); @@ -499,6 +504,27 @@ class sudo extends plugin function check() { $message = plugin::check(); + + /* Is a name given? */ + if(empty($this->cn)){ + $message[] = msgPool::required(_("Name")); + } + + /* Check name */ + if(!preg_match("/^[a-z]*$/i",$this->cn)){ + $message[] = msgPool::invalid(_("Name"),$this->cn,"/[a-z]/i"); + } + + /* Check if this entry will cause duplicated ldap entries */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->get_sudoers_ou($this->config)); + $ldap->search("(&(objectClass=sudoRole)(cn=".$this->cn."))"); + while($attrs = $ldap->fetch()){ + if($attrs['dn'] != $this->dn){ + $message[] = msgPool::duplicated(_("Name")); + } + } + return ($message); } diff --git a/gosa-plugins/sudo/admin/sudo/generic.tpl b/gosa-plugins/sudo/admin/sudo/generic.tpl index 08450eefa..d43757612 100644 --- a/gosa-plugins/sudo/admin/sudo/generic.tpl +++ b/gosa-plugins/sudo/admin/sudo/generic.tpl @@ -1,7 +1,35 @@ +{if $is_default} + +

{t}Sudo generic{/t} - {t}Global defaults{/t}

+ + + + + + + + + +
+ {t}Name{/t} + + {render acl=$cnACL} + + {/render} +
+ {t}Description{/t} + + {render acl=$descriptionACL} + + {/render} +
+ +{else} +
-

Sudo generic

+

{t}Sudo generic{/t}

@@ -116,3 +144,4 @@
+{/if}