Author: rhafer Date: Fri Jun 27 15:59:30 2008 New Revision: 48632 URL: http://svn.opensuse.org/viewcvs/yast?rev=48632&view=rev Log: ppolicy UI work Modified: trunk/ldap-server/src/tree_structure.ycp trunk/ldap-server/src/widgets.ycp Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.yc... ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:59:30 2008 @@ -916,11 +916,15 @@ string rootdn = db["rootdn"]:""; boolean append_checked = false; - integer pos = find( rootdn, db["suffix"]:"" ); + integer pos = search( rootdn, db["suffix"]:"" ); if( pos > -1 ) { - rootdn = substring( rootdn, 0, pos-1 ); - append_checked = true; + string chkSuffix = substring( rootdn, pos ); + if (chkSuffix == db["suffix"]:"") + { + rootdn = substring( rootdn, 0, pos-1 ); + append_checked = true; + } } UI::ChangeWidget( `te_rootdn, `Value, rootdn ); UI::ChangeWidget( `cb_append_basedn, `Value, append_checked ); @@ -928,62 +932,15 @@ // UI::ChangeWidget( `te_valid_rootpw, `Value, db["passwd"]:"" ); // UI::ChangeWidget( `cb_cryptmethod, `Value, (string)db["cryptmethod"]:"SSHA" ); // -// // Check for ppolicy overlay -// map<string,string> ppolicy_map = LdapServer::GetPasswordPolicyOverlay(suffix); -// if ( ppolicy_map != nil ){ -// UI::ChangeWidget( `cb_ppolicy_overlay, `Value, true ); -// string pp_hash_cleartext = ppolicy_map["ppolicy_hash_cleartext"]:nil; -// string pp_use_lockout = ppolicy_map["ppolicy_use_lockout"]:nil; -// string pp_default = ppolicy_map["ppolicy_default"]:nil; -// boolean pp_append_checked = false; -// integer pos = find( pp_default, suffix ); -// if( pos > -1 ) -// { -// pp_default = substring( pp_default, 0, pos-1 ); -// pp_append_checked = true; -// } -// if ( pp_hash_cleartext != nil ){ -// UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Value, true ); -// } else { -// UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Value, false ); -// } -// if ( pp_use_lockout != nil ){ -// UI::ChangeWidget( `cb_ppolicy_uselockout, `Value, true ); -// } else { -// UI::ChangeWidget( `cb_ppolicy_uselockout, `Value, false ); -// } -// if ( pp_default != nil ){ -// UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Value, pp_default ); -// UI::ChangeWidget( `cb_pp_append_basedn, `Value, pp_append_checked ); -// } else { -// UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Value, "" ); -// UI::ChangeWidget( `cb_pp_append_basedn, `Value, true ); -// } -// } else { -// UI::ChangeWidget( `cb_ppolicy_overlay, `Value, false ); -// UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , false ); -// UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , false ); -// UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , false ); -// } return true; } define boolean cb_input_db() ``{ - string suffix = current_tree_item; - y2milestone( "calling db input handler for suffix '%1'", suffix ); + string treeItem = current_tree_item; + y2milestone( "calling db input handler for item '%1'", treeItem ); integer index = (integer)widget_map[current_tree_item,"index"]:nil; - if ( handler_cmd == `cb_ppolicy_overlay ) { - if ( UI::QueryWidget( `cb_ppolicy_overlay, `Value ) == true ) { - UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , true ); - UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , true ); - UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , true ); - } else { - UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , false ); - UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , false ); - UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , false ); - } - } else if ( handler_cmd == `pb_changepw ) { + if ( handler_cmd == `pb_changepw ) { map<string,string> newpw = ChangeAdminPassword(); if ( newpw != nil ) { @@ -1081,6 +1038,77 @@ return true; } +define boolean cb_input_ppolicy() +{ + y2milestone("cb_input_ppolicy()"); + string treeItem = current_tree_item; + y2milestone( "calling db input handler for item '%1'", treeItem ); + integer index = (integer)widget_map[current_tree_item,"index"]:nil; + if ( handler_cmd == `cb_ppolicy_overlay ) { + if ( UI::QueryWidget( `cb_ppolicy_overlay, `Value ) == true ) { + UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , true ); + UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , true ); + UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , true ); + UI::ChangeWidget( `cb_pp_append_basedn, `Enabled, true ); + } else { + UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , false ); + UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , false ); + UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , false ); + UI::ChangeWidget( `cb_pp_append_basedn, `Enabled, false ); + } + } + return true; +} + +define boolean cb_read_ppolicy() +{ + y2milestone("cb_read_ppolicy()"); + // Check for ppolicy overlay + //map<string,string> ppolicy_map = LdapServer::GetPasswordPolicyOverlay(suffix); + string suffix = ""; + map<string,string> ppolicy_map = nil; + if ( ppolicy_map != nil ){ + UI::ChangeWidget( `cb_ppolicy_overlay, `Value, true ); + string pp_hash_cleartext = ppolicy_map["ppolicy_hash_cleartext"]:nil; + string pp_use_lockout = ppolicy_map["ppolicy_use_lockout"]:nil; + string pp_default = ppolicy_map["ppolicy_default"]:nil; + boolean pp_append_checked = false; + integer pos = search( pp_default, suffix ); + if( pos > -1 ) + { + string chkSuffix = substring( pp_default, pos ); + if ( chkSuffix == suffix ) + { + pp_default = substring( pp_default, 0, pos-1 ); + pp_append_checked = true; + } + } + if ( pp_hash_cleartext != nil ){ + UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Value, true ); + } else { + UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Value, false ); + } + if ( pp_use_lockout != nil ){ + UI::ChangeWidget( `cb_ppolicy_uselockout, `Value, true ); + } else { + UI::ChangeWidget( `cb_ppolicy_uselockout, `Value, false ); + } + if ( pp_default != nil ){ + UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Value, pp_default ); + UI::ChangeWidget( `cb_pp_append_basedn, `Value, pp_append_checked ); + } else { + UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Value, "" ); + UI::ChangeWidget( `cb_pp_append_basedn, `Value, true ); + } + } else { + UI::ChangeWidget( `cb_ppolicy_overlay, `Value, false ); + UI::ChangeWidget( `cb_ppolicy_hashcleartext, `Enabled , false ); + UI::ChangeWidget( `cb_ppolicy_uselockout, `Enabled , false ); + UI::ChangeWidget( `te_ppolicy_defaultpolicy, `Enabled , false ); + } + return true; +} + /***************************************** ** tree structure definition ** *****************************************/ @@ -1165,9 +1193,16 @@ "cb_read" : ``(cb_read_bdb_index() ), "cb_input" : ``(cb_input_bdb_index() ) ]; + map<string, any> dbPpolicy = $[ + "name" : _("Password Policy Configuration"), + "widget" : editPolicy, + "index" : index, + "cb_read" : ``(cb_read_ppolicy() ), + "cb_input" : ``(cb_input_ppolicy() ) + ]; map<string,any> item_map = $[ "name" : label, - "children" : [ item_name + "_index" ], + "children" : [ item_name + "_index", item_name + "_ppolicy" ], "index" : index, "widget" : editBdbDatabase, "new_db" : new_db, @@ -1181,6 +1216,7 @@ y2milestone( "adding database item '%1' as '%2'", label, item_name ); widget_map[item_name] = item_map; widget_map[item_name + "_index"] = dbIndex; + widget_map[item_name + "_ppolicy"] = dbPpolicy; widget_map["databases","children"] = add( widget_map["databases","children"]:[], item_name ); } Modified: trunk/ldap-server/src/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/widgets.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/widgets.ycp (original) +++ trunk/ldap-server/src/widgets.ycp Fri Jun 27 15:59:30 2008 @@ -338,9 +338,10 @@ ) ); term editPolicy = - `VBox( - `VSpacing( 1 ), - `Frame( _("Password Policy Settings"), + `Top( + `VBox( + `VSpacing( 1 ), + `Heading( _("Password Policy Settings") ), `VBox( `VSpacing(0.25), `HBox( `CheckBox( `id( `cb_ppolicy_overlay ),`opt(`notify ), @@ -362,7 +363,8 @@ ), `VSquash( `HBox( - `TextEntry( `id( `te_ppolicy_defaultpolicy ), + `InputField( `id( `te_ppolicy_defaultpolicy ), + `opt( `hstretch ), _("Default Policy Object DN"), "cn=Default Policy" ), `HSpacing( 0.5 ), -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org