Skip to content

Commit

Permalink
Merge pull request #38 from ckornacker/master
Browse files Browse the repository at this point in the history
migrate to AuthClient module
  • Loading branch information
varkoly committed Mar 12, 2014
2 parents 9c2bd27 + 329dab0 commit 1264f79
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 43 deletions.
6 changes: 6 additions & 0 deletions package/yast2-users.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 3 10:31:26 UTC 2014 - ckornacker@suse.com

- migrate ldap/kerberos-client to auth-client (bnc#865812)
- 3.1.14

-------------------------------------------------------------------
Fri Feb 28 13:41:12 CET 2014 - jsuchome@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-users.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-users
Version: 3.1.13
Version: 3.1.14
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
74 changes: 32 additions & 42 deletions src/include/users/widgets.rb
Expand Up @@ -34,6 +34,7 @@ def initialize_users_widgets(include_target)
Yast.import "CWMTab"
Yast.import "Label"
Yast.import "Ldap"
Yast.import "AuthClient"
Yast.import "Message"
Yast.import "Mode"
Yast.import "Package"
Expand Down Expand Up @@ -126,7 +127,7 @@ def initialize_users_widgets(include_target)
# list of installed clients
@installed_clients = []

@configurable_clients = ["nis", "ldap", "kerberos", "samba"]
@configurable_clients = ["nis", "sssd", "samba"]

# save if no more Available calls should be done (bug #225484)
@check_available = true
Expand All @@ -135,16 +136,32 @@ def initialize_users_widgets(include_target)
# richtext label
"nis" => _("NIS"),
# richtext label
"ldap" => _("LDAP"),
# richtext label
"kerberos" => _("Kerberos"),
"sssd" => _("SSSD"),
# richtext label
"samba" => _("Samba")
}

# name of module to call
@call_module = { "samba" => "samba-client" }

# auth methods and respective module calls
@auth_methods = {
"nis" => {
# menubutton label
"label" => _("&NIS"),
"package" => "yast2-nis-client",
"call" => "nis-client"
},
"sssd" => {
# menubutton label
"label" => _("&SSSD"),
"package" => "yast2-auth-client",
"call" => "auth-client"
},
"samba" => {
# menubutton label
"label" => _("&Samba"),
"package" => "yast2-samba-client",
"call" => "samba-client"
},
}

@tabs_description = {
"users" => {
Expand Down Expand Up @@ -429,7 +446,7 @@ def initialize_users_widgets(include_target)
MenuButton(Opt(:key_F4), _("&Configure..."), [])
)
),
"handle_events" => ["ldap", "nis", "kerberos", "samba"]
"handle_events" => ["sssd", "nis", "samba"]
}
}
end
Expand Down Expand Up @@ -2308,17 +2325,13 @@ def get_module_data(client)
progress_orig = Progress.set(false)
if !Builtins.contains(@installed_clients, client)
ret = Summary.NotConfigured
elsif client == "ldap"
Ldap.Read
ret = Ldap.ShortSummary
elsif client == "sssd"
AuthClient.Read
ret = AuthClient.Summary
elsif client == "nis"
WFM.CallFunction("nis_auto", ["Read"])
a = WFM.CallFunction("nis_auto", ["ShortSummary"])
ret = Convert.to_string(a) if Ops.is_string?(a)
elsif client == "kerberos"
WFM.CallFunction("kerberos-client_auto", ["Read"])
a = WFM.CallFunction("kerberos-client_auto", ["ShortSummary"])
ret = Convert.to_string(a) if Ops.is_string?(a)
elsif client == "samba"
WFM.CallFunction("samba-client_auto", ["Read"])
a = WFM.CallFunction("samba-client_auto", ["ShortSummary"])
Expand Down Expand Up @@ -2356,37 +2369,14 @@ def reload_config(clients)
def InitAuthData(key)
mb = []

auth_methods = {
"nis" => {
# menubutton label
"label" => _("&NIS"),
"package" => "yast2-nis-client",
},
"ldap" => {
# menubutton label
"label" => _("&LDAP"),
"package" => "yast2-auth-client",
},
"kerberos" => {
# menubutton label
"label" => _("&Kerberos"),
"package" => "yast2-auth-client",
},
"samba" => {
# menubutton label
"label" => _("&Samba"),
"package" => "yast2-samba-client",
},
}

# check availability of authentication packages,
# update the RichText summary and menubutton labels accordingly
Builtins.foreach(@configurable_clients) do |client|
package = auth_methods[client]["package"] or raise "Unknown auth client #{client}"
package = @auth_methods[client]["package"] or raise "Unknown auth client #{client}"

client_item = Item(
Id(client),
auth_methods[client]["label"]
@auth_methods[client]["label"]
)

if Package.Installed(package)
Expand Down Expand Up @@ -2426,7 +2416,7 @@ def HandleAuthData(key, event)
return nil if !Builtins.contains(@configurable_clients, button)

if !Builtins.contains(@installed_clients, button)
package = Builtins.sformat("yast2-%1-client", button)
package = @auth_methods[client]["package"]
if @check_available
avai = Package.Available(package)
if avai == nil
Expand Down Expand Up @@ -2462,7 +2452,7 @@ def HandleAuthData(key, event)
end
end
param = installation ? ["from_users"] : []
if WFM.CallFunction(Ops.get_string(@call_module, button, button), param) == :next
if WFM.CallFunction(@auth_methods[button]["call"], param) == :next
UI.ChangeWidget(Id("auth_summary"), :Value, reload_config([]))
end
nil
Expand Down

0 comments on commit 1264f79

Please sign in to comment.