Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <web-client> master : adapted for changes in rest-service model
  • From: Jiri Suchomel <jsuchome@xxxxxxx>
  • Date: Tue, 7 Jul 2009 16:27:05 +0200
  • Message-id: <E1MOBd5-0002sw-Et@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 952ee2777ad3e991ef721191d5d9a2de96232ac4
Author: Jiri Suchomel <jsuchome@xxxxxxx>
Date: Tue Jul 7 16:27:05 2009 +0200

adapted for changes in rest-service model
---
plugins/users/app/controllers/users_controller.rb | 114 ++++++++++-----------
plugins/users/app/views/users/edit.html.erb | 18 ++--
plugins/users/app/views/users/exportssh.html.erb | 4 +-
plugins/users/app/views/users/index.html.erb | 6 +-
plugins/users/app/views/users/new.html.erb | 16 ++--
5 files changed, 77 insertions(+), 81 deletions(-)

diff --git a/plugins/users/app/controllers/users_controller.rb
b/plugins/users/app/controllers/users_controller.rb
index bf55c3f..afa0002 100644
--- a/plugins/users/app/controllers/users_controller.rb
+++ b/plugins/users/app/controllers/users_controller.rb
@@ -50,21 +50,18 @@ class UsersController < ApplicationController
def new
return unless client_permissions
@user = @client.new( :id => :nil,
- :no_home=>nil,
- :default_group=>nil,
- :new_login_name=>nil,
- :login_name=>nil,
- :groups=>[],
- :grp_string=>nil,
- :home_directory=>nil,
- :full_name=>nil,
- :uid=>nil,
- :sshkey=>nil,
- :new_uid=>nil,
- :login_shell=>"/bin/bash",
- :password=>nil,
- :type=>"local",
- :id=>nil )
+ :groupname => nil,
+ :cn => nil,
+ :grouplist => {},
+ :homeDirectory => nil,
+ :cn => nil,
+ :uid => nil,
+ :sshkey => nil,
+ :loginShell => "/bin/bash",
+ :userPassword => nil,
+ :type => "local",
+ :id => nil
+ )
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
@@ -76,7 +73,7 @@ class UsersController < ApplicationController
return unless client_permissions
@user = @client.find(params[:id])
@user.type = ""
- @user.id = @user.login_name
+ @user.id = @user.uid
logger.debug "exportssh: #{@user.inspect}"
respond_to do |format|
format.html # exportssh.html.erb
@@ -89,11 +86,11 @@ class UsersController < ApplicationController
return unless client_permissions

@user = @client.find(params[:id])
- @user.type = ""
- @user.id = @user.login_name
+
+ @user.type = ""
+ @user.id = @user.uid
@user.grp_string = ""
counter = 0
- @user.grp_string = ""
@user.grouplist.each do |group|
if counter == 0
@user.grp_string = group.id
@@ -108,8 +105,8 @@ class UsersController < ApplicationController
def sshexport
return unless client_permissions

- @user = @client.find(params["user"]["login_name"])
- @user.id = @user.login_name
+ @user = @client.find(params["user"]["uid"])
+ @user.id = @user.uid
logger.debug "sshexportssh: #{@user.inspect}"
@user.sshkey = params["user"]["sshkey"]
response = true
@@ -145,24 +142,23 @@ class UsersController < ApplicationController
dummy.groups << { :id=>group.strip }
end
end
- @user = @client.new(:no_home=>params[:nohome],
- :default_group=>dummy.default_group,
- :new_login_name=>nil,
- :login_name=>dummy.login_name,
- :groups=>dummy.groups,
- :grp_string=>dummy.grp_string,
- :home_directory=>dummy.home_directory,
- :full_name=>dummy.full_name,
- :uid=>dummy.uid,
- :sshkey=>nil,
- :new_uid=>nil,
- :login_shell=>dummy.login_shell,
- :password=>dummy.password,
- :type=>"local")
+ @user = @client.new(
+ :groupname => dummy.groupname,
+ :uid => dummy.uid,
+ :grouplist => dummy.grouplist,
+# :grp_string=>dummy.grp_string,
+ :homeDirectory => dummy.homeDirectory,
+ :cn => dummy.cn,
+ :uidNumber => dummy.uidNumber,
+ :sshkey => nil,
+ :loginShell => dummy.loginShell,
+ :userPassword => dummy.userPassword,
+ :type => "local"
+ )

#Only UID greater than 1000 are allowed for local user
response = true
- if @user.uid.to_i < 1000
+ if @user.uidNumber.to_i < 1000
response = false
else
begin
@@ -177,7 +173,7 @@ class UsersController < ApplicationController
flash[:notice] = _('User was successfully created.')
format.html { redirect_to(users_url) }
else
- if @user.uid.to_i < 1000
+ if @user.uidNumber.to_i < 1000
#Only UID greater than 1000 are allowed for local user
flash[:error] = _("UID: value >= 1000 is valid for local user only")
end
@@ -192,27 +188,27 @@ class UsersController < ApplicationController
def update
return unless client_permissions
@user = @client.find(params[:id])
- @user.new_login_name = nil
- @user.new_uid = nil
- @user.id = @user.login_name
- @user.default_group = params["user"]["default_group"]
- @user.groups = []
- if params["user"]["grp_string"] != nil
- @user.grp_string = params["user"]["grp_string"]
- params["user"]["grp_string"].split(",").each do |group|
- @user.groups << { :id=>group.strip }
- end
- end
- if @user.login_name != params["user"]["login_name"]
- @user.new_login_name = params["user"]["login_name"]
- end
- @user.home_directory = params["user"]["home_directory"]
- @user.full_name = params["user"]["full_name"]
- if @user.uid != params["user"]["uid"]
- @user.new_uid = params["user"]["uid"]
- end
- @user.login_shell = params["user"]["login_shell"]
- @user.password = params["user"]["password"]
+ @user.id = @user.uid
+ @user.groupname = params["user"]["groupname"]
+ @user.grouplist = {}
+# if params["user"]["grp_string"] != nil
+# @user.grp_string = params["user"]["grp_string"]
+# params["user"]["grp_string"].split(",").each do |group|
+# @user.groups << { :id=>group.strip }
+# end
+# end
+# FIXME solve renaming...
+# if @user.login_name != params["user"]["login_name"]
+# @user.new_login_name = params["user"]["login_name"]
+# end
+# if @user.uid != params["user"]["uid"]
+# @user.new_uid = params["user"]["uid"]
+# end
+ @user.uidNumber = params["user"]["uidNumber"]
+ @user.homeDirectory = params["user"]["homeDirectory"]
+ @user.cn = params["user"]["cn"]
+ @user.loginShell = params["user"]["loginShell"]
+ @user.userPassword = params["user"]["userPassword"]
@user.type = "local"

respond_to do |format|
@@ -239,7 +235,7 @@ class UsersController < ApplicationController
def destroy
return unless client_permissions
@user = @client.find(params[:id])
- @user.id = @user.login_name
+ @user.id = @user.uid
@user.type = "local"
@user.destroy

diff --git a/plugins/users/app/views/users/edit.html.erb
b/plugins/users/app/views/users/edit.html.erb
index 81161fe..1d186ac 100644
--- a/plugins/users/app/views/users/edit.html.erb
+++ b/plugins/users/app/views/users/edit.html.erb
@@ -1,4 +1,4 @@
-<h1><%=_("Edit User %s") %@xxxxxxxxxxxxxxx %></h1>
+<h1><%=_("Edit User %s") %@xxxxxxxx%></h1>
<br>

<% disabled = ! @permissions[:usermodify] %>
@@ -13,7 +13,7 @@
</tr>
<tr>
<td class="first" width="120"><strong><%=_("Full Name")%></strong></td>
- <td class="last"><%= f.text_field :full_name, :disabled => disabled
%></td>
+ <td class="last"><%= f.text_field :cn , :disabled => disabled %></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Groups")%></strong></td>
@@ -21,27 +21,27 @@
</tr>
<tr>
<td class="first"><strong><%=_("Default Group")%></strong></td>
- <td class="last"><%= f.text_field :default_group, :disabled => disabled
%></td>
+ <td class="last"><%= f.text_field :groupname, :disabled => disabled
%></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Home Directory")%></strong></td>
- <td class="last"><%= f.text_field :home_directory, :disabled =>
disabled %></td>
+ <td class="last"><%= f.text_field :homeDirectory, :disabled => disabled
%></td>
</tr>
<tr>
<td class="first"><strong><%=_("Login Shell")%></strong></td>
- <td class="last"><%= f.text_field :login_shell, :disabled => disabled
%></td>
+ <td class="last"><%= f.text_field :loginShell, :disabled => disabled
%></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Login Name")%></strong></td>
- <td class="last"><%= f.text_field :login_name, :disabled => disabled
%></td>
+ <td class="last"><%= f.text_field :uid, :disabled => disabled %></td>
</tr>
<tr>
- <td class="first"><strong><%=_("UID")%></strong></td>
- <td class="last"><%= f.text_field :uid, :disabled => disabled %></td>
+ <td class="first"><strong><%=_("UID Number")%></strong></td>
+ <td class="last"><%= f.text_field :uidNumber , :disabled => disabled
%></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Password")%></strong></td>
- <td class="last"><%= f.text_field :password, :disabled => disabled
%></td>
+ <td class="last"><%= f.text_field :userPassword, :disabled => disabled
%></td>
</tr>
</table>
<p><%= f.submit _("Update"), :disabled => disabled %><%= link_to
_('Back'), users_path, :onclick=>"Element.show('progress')", :class =>
"button"%></p>
diff --git a/plugins/users/app/views/users/exportssh.html.erb
b/plugins/users/app/views/users/exportssh.html.erb
index c5d6578..af773a6 100644
--- a/plugins/users/app/views/users/exportssh.html.erb
+++ b/plugins/users/app/views/users/exportssh.html.erb
@@ -9,11 +9,11 @@
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Login Name")%></strong></td>
- <td class="last"><%= f.text_field :login_name, :disabled => false
%></td>
+ <td class="last"><%= f.text_field :uid, :disabled => false %></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Home Directory")%></strong></td>
- <td class="last"><%=h @user.home_directory %></td>
+ <td class="last"><%=h @user.homeDirectory %></td>
</tr>
<tr>
<td class="first"><strong><%=_("SHH Key")%></strong></td>
diff --git a/plugins/users/app/views/users/index.html.erb
b/plugins/users/app/views/users/index.html.erb
index 9691d50..74b63c2 100644
--- a/plugins/users/app/views/users/index.html.erb
+++ b/plugins/users/app/views/users/index.html.erb
@@ -14,12 +14,12 @@
</tr>
<% for user in @users %>
<tr>
- <td><strong><%=h user.login_name %></strong></td>
- <td><%=h user.full_name %></td>
+ <td><strong><%=h user.uid %></strong></td>
+ <td><%=h user.cn %></td>
<td><%= html_edit_link(user.id) %></td>
<td><%= link_to image_tag("/images/key_add.png", :alt => "key"),
exportssh_user_path(:id=>user.id), :onclick=>"Element.show('progress')" %></td>
<% if @permissions[:userdelete] %>
- <td class="last"><%= html_delete_link(user.login_name) %></td>
+ <td class="last"><%= html_delete_link(user.uid) %></td>
<% end %>
</tr>
<% end %>
diff --git a/plugins/users/app/views/users/new.html.erb
b/plugins/users/app/views/users/new.html.erb
index c373058..d443fde 100644
--- a/plugins/users/app/views/users/new.html.erb
+++ b/plugins/users/app/views/users/new.html.erb
@@ -7,7 +7,7 @@
<table class="list">
<tr>
<td class="first" width="120"><strong><%=_("Full Name")%></strong></td>
- <td class="last"><%= f.text_field :full_name %></td>
+ <td class="last"><%= f.text_field :cn %></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Groups")%></strong></td>
@@ -15,11 +15,11 @@
</tr>
<tr>
<td class="first"><strong><%=_("Default Group (GID)")%></strong></td>
- <td class="last"><%= f.text_field :default_group %></td>
+ <td class="last"><%= f.text_field :groupname %></td>
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Home Directory")%></strong></td>
- <td class="last"><%= f.text_field :home_directory %></td>
+ <td class="last"><%= f.text_field :homeDirectory %></td>
</tr>
<tr>
<td class="first"><strong><%=_("do NOT create home
directory")%></strong></td>
@@ -27,19 +27,19 @@
</tr>
<tr class="bg">
<td class="first"><strong><%=_("Login Shell")%></strong></td>
- <td class="last"><%= f.text_field :login_shell %></td>
+ <td class="last"><%= f.text_field :loginShell %></td>
</tr>
<tr>
<td class="first"><strong><%=_("Login Name")%></strong></td>
- <td class="last"><%= f.text_field :login_name %></td>
+ <td class="last"><%= f.text_field :uid %></td>
</tr>
<tr class="bg">
- <td class="first"><strong><%=_("UID")%></strong></td>
- <td class="last"><%= f.text_field :uid %></td>
+ <td class="first"><strong><%=_("UID Number")%></strong></td>
+ <td class="last"><%= f.text_field :uidNumber %></td>
</tr>
<tr>
<td class="first"><strong><%=_("Password")%></strong></td>
- <td class="last"><%= f.text_field :password %></td>
+ <td class="last"><%= f.text_field :userPassword %></td>
</tr>
</table>
<p><%= f.submit _("Create"), :onclick=>"Element.show('progress')" %><%=
link_to _('Back'), users_path, :onclick=>"Element.show('progress')", :class =>
"button" %></p>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages