From d8c229cd6d04601462c7fd3141b6af4d978399ae Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 6 May 2010 10:12:01 +0000 Subject: [PATCH] Updated property viewer -Added some check methods. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18177 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_configRegistry.inc | 35 +++++++++++++++++++ gosa-core/include/class_core.inc | 12 +++---- .../configViewer/class_configViewer.inc | 12 +++++-- .../addons/configViewer/property-list.xml | 2 +- 4 files changed, 52 insertions(+), 9 deletions(-) diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index a3f46e835..076f626ef 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -217,6 +217,41 @@ class gosaProperty $this->_restoreCurrentValue(); } + static function isBool($message,$class,$name,$value, $type) + { + return(in_array($value,array('true','false',''))); + } + + static function isInteger($message,$class,$name,$value, $type) + { + return(is_numeric($value) && !preg_match("/[^0-9]/", $value)); + } + + static function isPath($message,$class,$name,$value, $type) + { + return(TRUE); + } + + static function isExistingPath($message,$class,$name,$value, $type) + { + return(TRUE); + } + + static function isCommand($message,$class,$name,$value, $type) + { + return(TRUE); + } + + static function isDn($message,$class,$name,$value, $type) + { + return(TRUE); + } + + static function isRdn($message,$class,$name,$value, $type) + { + return(TRUE); + } + private function _restoreCurrentValue() { diff --git a/gosa-core/include/class_core.inc b/gosa-core/include/class_core.inc index 947f475a0..ab8a50c83 100644 --- a/gosa-core/include/class_core.inc +++ b/gosa-core/include/class_core.inc @@ -145,7 +145,7 @@ class core extends plugin { "default" => "", "description" => _("The 'passwordHook' can specify an external script to handle password settings at some other location besides the LDAP.")." ".sprintf(_("It will be called this way: %s"),"/path/to/your/script \"username\" \"oldpassword\" \"newpassword\""), - "check" => "gosaProperty::isShellCommand", + "check" => "gosaProperty::isCommand", "migrate" => "", "group" => "password", "mandatory" => FALSE), @@ -165,7 +165,7 @@ class core extends plugin { "type" => "bool", "default" => TRUE, "description" => "The 'schemaCheck' statement enables or disables schema checking during login. It is recommended to switch this on in order to let GOsa handle object creation more efficient.", - "check" => "gosaProperty::isInteger", + "check" => "gosaProperty::isBool", "migrate" => "", "group" => "debug", "mandatory" => FALSE), @@ -175,7 +175,7 @@ class core extends plugin { "type" => "bool", "default" => FALSE, "description" => "The 'copyPaste' statement enables copy and paste for LDAP entries managed with GOsa.", - "check" => "gosaProperty::isInteger", + "check" => "gosaProperty::isBool", "migrate" => "", "group" => "copyPaste", "mandatory" => FALSE), @@ -524,7 +524,7 @@ DEBUG_SI = 256"), "type" => "rdn", "default" => "ou=winstations", "description" => "This statement defines the location where GOsa looks for new samba workstations.", - "check" => "gosaProperty::isRDN", + "check" => "gosaProperty::isRdn", "migrate" => "", "group" => "samba", "mandatory" => FALSE), @@ -582,8 +582,8 @@ DEBUG_SI = 256"), array( "name" => "minId", "type" => "integer", - "default" => "The 'minId' statement defines the minimum assignable user or group id to avoid security leaks with uid 0 accounts. This is used for the 'traditional' method.", - "description" => "", + "default" => "", + "description" => "The 'minId' statement defines the minimum assignable user or group id to avoid security leaks with uid 0 accounts. This is used for the 'traditional' method.", "check" => "gosaProperty::isInteger", "migrate" => "", "group" => "core", diff --git a/gosa-core/plugins/addons/configViewer/class_configViewer.inc b/gosa-core/plugins/addons/configViewer/class_configViewer.inc index ada7e6fb9..08d27d83a 100644 --- a/gosa-core/plugins/addons/configViewer/class_configViewer.inc +++ b/gosa-core/plugins/addons/configViewer/class_configViewer.inc @@ -121,7 +121,7 @@ class configViewer extends management $tooltip = ""; return($tooltip."{$cn[0]}"); } - static function propertyValue($class,$cn,$value,$type,$default,$defaults) + static function propertyValue($class,$cn,$value,$type,$default,$defaults,$check) { $ssize = "208px"; $isize = "200px"; @@ -163,7 +163,15 @@ class configViewer extends management default: echo $type[0].$name." ";$res = ""; } - return($res." (".$value).")"; + // Color row in red if the check methods returns false. + if(!empty($check[0])){ + $check = call_user_func(preg_split("/::/", $check[0]),$displayMessage=FALSE, $class[0], $cn[0], $value, $type[0]); + if(!$check){ + $res.= ""; + } + } + + return($res." (".$value.")"); } } ?> diff --git a/gosa-core/plugins/addons/configViewer/property-list.xml b/gosa-core/plugins/addons/configViewer/property-list.xml index 54794a140..562ecdb1e 100644 --- a/gosa-core/plugins/addons/configViewer/property-list.xml +++ b/gosa-core/plugins/addons/configViewer/property-list.xml @@ -88,7 +88,7 @@ value string - %{filter:propertyValue(class,cn,value,type,default,defaults)} + %{filter:propertyValue(class,cn,value,type,default,defaults,check)} true -- 2.30.2