This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "YaST web service".
The branch, master has been updated
via 4a0d4cd07b0e68c9595c12b43c71a71642213434 (commit)
from f18bfcbaf2e91655b4e2798d9dee99d15da03813 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4a0d4cd07b0e68c9595c12b43c71a71642213434
Author: Jiri Suchomel
Date: Fri Jun 26 14:22:08 2009 +0200
replacing CLI with DBUS for read methods
-----------------------------------------------------------------------
Summary of changes and diff:
plugins/users/app/controllers/users_controller.rb | 63 ++++++++++-----------
plugins/users/app/models/user.rb | 10 +++
2 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/plugins/users/app/controllers/users_controller.rb b/plugins/users/app/controllers/users_controller.rb
index a376e39..5adb167 100644
--- a/plugins/users/app/controllers/users_controller.rb
+++ b/plugins/users/app/controllers/users_controller.rb
@@ -22,10 +22,14 @@ class UsersController < ApplicationController
def get_user_list
@users = []
- # FIXME see convert_map in samba_share.rb
parameters = {
- "type" => [ "s", "local" ],
- "index" => [ "s", "uid" ]
+ # how to index hash with users
+ "index" => [ "s", "uid" ],
+ # attributes to return for each user
+ "user_attributes" => [ "as", [ "cn" ]]
+# FIXME this way of passing array currently fails in ruby-dbus:
+# TypeError (can't convert Array into String):
+# /usr/lib64/ruby/vendor_ruby/1.8/dbus/type.rb:112:in `+'
}
users_map = YastService.Call("YaPI::USERS::UsersGet", parameters)
if users_map.nil?
@@ -33,8 +37,8 @@ class UsersController < ApplicationController
else
users_map.each do |key, val|
user = User.new
- # FIXME adapt the model to the return map
- user.login_name = val["uid"]
+ # FIXME adapt the model to the YaPI return map
+ user.login_name = key
user.full_name = val["cn"]
@users << user
end
@@ -47,36 +51,27 @@ class UsersController < ApplicationController
else
saveKey = nil
end
- ret = @scr.execute(["/sbin/yast2", "users", "show", "username=#{id}"])
- if (!ret or
- ret[:stderr].include?("There is no such user."))
- return false
- end
- lines = ret[:stderr].split "\n"
- counter = 0
+ parameters = {
+ # user to find
+ "uid" => [ "s", id ],
+ # list of attributes to return;
+ "user_attributes" => [ "as", [
+ "cn", "uidNumber", "homeDirectory",
+ "grouplist", "loginShell", "groupname"
+ ]]
+ }
+ user_map = YastService.Call("YaPI::USERS::UserGet", parameters)
@user = User.new
- lines.each do |s|
- if counter+1 <= lines.length
- case s
- when "Full Name:"
- @user.full_name = lines[counter+1].strip
- when "List of Groups:"
- @user.groups = lines[counter+1].strip
- when "Default Group:"
- @user.default_group = lines[counter+1].strip
- when "Home Directory:"
- @user.home_directory = lines[counter+1].strip
- when "Login Shell:"
- @user.login_shell = lines[counter+1].strip
- when "Login Name:"
- @user.login_name = lines[counter+1].strip
- when "UID:"
- @user.uid = lines[counter+1].strip
- end
- end
- counter += 1
- end
- @user.sshkey = saveKey
+ # FIXME adapt the model to the YaPI return map
+ @user.login_name = id
+ @user.full_name = user_map["cn"]
+ @user.login_shell = user_map["loginShell"]
+ @user.uid = user_map["uidNumber"]
+ @user.home_directory= user_map["homeDirectory"]
+ @user.default_group = user_map["groupname"]
+ @user.grouplist = user_map["grouplist"]
+
+ @user.sshkey = saveKey
return true
end
diff --git a/plugins/users/app/models/user.rb b/plugins/users/app/models/user.rb
index 2896505..e53c3a1 100644
--- a/plugins/users/app/models/user.rb
+++ b/plugins/users/app/models/user.rb
@@ -3,6 +3,7 @@ class User
attr_accessor :full_name,
:groups,
+ :grouplist,
:default_group,
:home_directory,
:login_name,
@@ -28,6 +29,7 @@ class User
@no_home = false
@full_name = ""
@groups = ""
+ @grouplist = {}
@default_group = ""
@home_directory = ""
@login_shell = ""
@@ -45,6 +47,7 @@ class User
return false if usr==nil
@no_home = usr[:no_home]
@groups = usr[:groups]
+ @grouplist = usr[:grouplist]
@home_directory = usr[:home_directory]
@type = usr[:type]
@new_login_name = usr[:new_login_name]
@@ -86,6 +89,13 @@ class User
end
end
end
+ xml.grouplist({:type => "array"}) do
+ grouplist.each do |group, val|
+ xml.group do
+ xml.tag!(:id, group)
+ end
+ end
+ end
end
end
hooks/post-receive
--
YaST web service
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org