Hello community,

here is the log from the commit of package webyast-users-ws for openSUSE:Factory
checked in at Wed May 4 10:37:49 CEST 2011.



--------
--- webyast-users-ws/webyast-users-ws.changes   2011-02-09 10:07:55.000000000 
+0100
+++ /mounts/work_src_done/STABLE/webyast-users-ws/webyast-users-ws.changes      
2011-05-02 14:47:41.000000000 +0200
@@ -1,0 +2,12 @@
+Mon May  2 12:47:34 UTC 2011 - [email protected]
+
+- adapt caching to the new job handling
+- 0.2.4 
+
+-------------------------------------------------------------------
+Tue Apr 12 13:36:33 UTC 2011 - [email protected]
+
+- new caching
+- 0.2.3 
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ webyast-users-ws.spec ++++++
--- /var/tmp/diff_new_pack.T25SEi/_old  2011-05-04 10:36:47.000000000 +0200
+++ /var/tmp/diff_new_pack.T25SEi/_new  2011-05-04 10:36:47.000000000 +0200
@@ -27,7 +27,7 @@
 Group:          Productivity/Networking/Web/Utilities
 Url:            http://en.opensuse.org/Portal:WebYaST
 AutoReqProv:    on
-Version:        0.2.2
+Version:        0.2.4
 Release:        1
 Summary:        WebYaST - users management
 Source:         www.tar.bz2


++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/www/app/controllers/groups_controller.rb 
new/www/app/controllers/groups_controller.rb
--- old/www/app/controllers/groups_controller.rb        2011-02-01 
10:49:11.000000000 +0100
+++ new/www/app/controllers/groups_controller.rb        2011-04-11 
12:49:05.000000000 +0200
@@ -71,7 +71,6 @@
       Rails.logger.error "No groups found."
       render ErrorResult.error(404, 2, "No groups found") and return
     end
-    @groups.sort! {|x,y| x.cn <=> y.cn}
 
     respond_to do |format|
       format.xml { render  :xml => @groups.to_xml(:root => "groups", 
:dasherize => false ) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/www/app/models/getent_passwd.rb 
new/www/app/models/getent_passwd.rb
--- old/www/app/models/getent_passwd.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/getent_passwd.rb 2011-04-29 18:23:25.000000000 +0200
@@ -25,28 +25,30 @@
   attr_reader :full_name
 
   def self.find
-    result = []
-    res = pure_getent
-    raise "cannot obtain passwd" unless res
-    minimum = system_minimum # RORSCAN_ITL
-    minimum = 1000 if minimum == 0 #fallback
-    lines = res.split "\n"
-    lines.each do |l|
-      elements = l.split ":"
-      if elements[2].to_i >= minimum &&
-        elements[0] != "nobody" #bnc#632326
-        result << GetentPasswd.new(:login => elements[0], :full_name => 
elements[4])
-      end
-    end
-    active_directory_users = pure_wbinfo
-    if $?
-      lines = active_directory_users.split "\n"
+    YastCache.fetch(self) {
+      result = []
+      res = pure_getent
+      raise "cannot obtain passwd" unless res
+      minimum = system_minimum # RORSCAN_ITL
+      minimum = 1000 if minimum == 0 #fallback
+      lines = res.split "\n"
       lines.each do |l|
-        l.chomp!
-        result << GetentPasswd.new(:login => l, :full_name => l)
+        elements = l.split ":"
+        if elements[2].to_i >= minimum &&
+          elements[0] != "nobody" #bnc#632326
+          result << GetentPasswd.new(:login => elements[0], :full_name => 
elements[4])
+        end
+      end
+      active_directory_users = pure_wbinfo
+      if $?
+        lines = active_directory_users.split "\n"
+        lines.each do |l|
+          l.chomp!
+          result << GetentPasswd.new(:login => l, :full_name => l)
+        end
       end
-    end
-    result
+      result
+    }
   end
 
 private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/www/app/models/group.rb new/www/app/models/group.rb
--- old/www/app/models/group.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/group.rb 2011-04-29 18:23:25.000000000 +0200
@@ -62,16 +62,23 @@
 public
 
   def self.find (cn)
-    result = group_get( "system", cn )
-    result = group_get( "local", cn )  if result.empty?
-    return nil if result.empty?
-    make_group result
+    return find_all if cn == :all
+    YastCache.fetch(self, cn) {
+      result = group_get( "system", cn )
+      result = group_get( "local", cn )  if result.empty?
+      return nil if result.empty?
+      make_group result
+    }
   end
 
   def self.find_all
-    result = groups_get "local"
-    result.update( groups_get "system")
-    result.collect { |k,v| make_group v }
+    YastCache.fetch(self, :all) {
+      result = groups_get "local"
+      result.update( groups_get "system")
+      result_array = []
+      result.each { |k,v| result_array << make_group(v) }
+      result_array.sort! {|x,y| x.cn <=> y.cn}
+    }
   end
 
   def save
@@ -89,15 +96,18 @@
                                    "userlist"  => ["as", members] } 
                                )
     end
+    YastCache.reset(self, old_cn)
     result # result is empty string on success, error message otherwise
   end
 
   def destroy
     existing_group = Group.group_get( group_type, old_cn )
     if existing_group.empty?
-      ""
+      ret = ""
     else
-      YastService.Call( "YaPI::USERS::GroupDelete", {"type" => 
["s",group_type], "cn" => ["s",old_cn]})
+      ret = YastService.Call( "YaPI::USERS::GroupDelete", {"type" => 
["s",group_type], "cn" => ["s",old_cn]})
     end
+    YastCache.delete(self,old_cn.inspect)
+    ret
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/www/app/models/user.rb new/www/app/models/user.rb
--- old/www/app/models/user.rb  2011-02-01 10:49:11.000000000 +0100
+++ new/www/app/models/user.rb  2011-04-29 18:23:25.000000000 +0200
@@ -38,58 +38,67 @@
   attr_accessor_with_default :user_password, ""
   attr_accessor_with_default :type, "local"
 
+public
+
   def initialize    
   end
   
   # users = User.find_all
   def self.find_all(params={})
-    attributes = [ "cn", "uidNumber", "homeDirectory", "grouplist", "uid", 
"loginShell", "groupname" ]
-    if params.has_key? "attributes"
-       attributes      = params["attributes"].split(",")
-    end
-    users = []
-    parameters = {
-      # how to index hash with users
-      "index"  => ["s", "uid"],
-      # attributes to return for each user
-      "user_attributes"        => [ "as", attributes ],
-      "type" => params["type"]||="local"
-    }
-    users_map = YastService.Call("YaPI::USERS::UsersGet", parameters)
-    if users_map.nil?
-      raise "Can't get user list"
-    else
-      users_map.each do |key, val|
-        user = User.new
-        user.load_data(val)
-        users << user
+    YastCache.fetch(self, :all) {
+      attributes = [ "cn", "uidNumber", "homeDirectory", "grouplist", "uid", 
"loginShell", "groupname" ]
+      if params.has_key? "attributes"
+        attributes = params["attributes"].split(",")
       end
-    end
-    users
+      users = []
+      parameters = {
+        # how to index hash with users
+        "index"        => ["s", "uid"],
+        # attributes to return for each user
+        "user_attributes"      => [ "as", attributes ],
+        "type" => params["type"]||="local"
+      }
+      users_map = YastService.Call("YaPI::USERS::UsersGet", parameters)
+      if users_map.nil?
+        raise "Can't get user list"
+      else
+        users_map.each do |key, val|
+          user = User.new
+          user.load_data(val)
+          users << user
+        end
+      end
+      users
+    }
   end
 
   # load the attributes of the user
   def self.find(id)
-    user = User.new
-    parameters = {
-      # user to find
-      "uid" => [ "s", id ],
-      # list of attributes to return;
-      "user_attributes"        =>
-        [ "as", [ "cn", "uidNumber", "homeDirectory",
+
+    return find_all if id == :all
+
+    YastCache.fetch(self, id) {
+      user = User.new
+      parameters       = {
+        # user to find
+        "uid" => [ "s", id ],
+        # list of attributes to return;
+        "user_attributes" =>
+          [ "as", [ "cn", "uidNumber", "homeDirectory",
                   "grouplist", "uid", "loginShell", "groupname" ] ]
-    }
-    user_map = YastService.Call("YaPI::USERS::UserGet", parameters)
+      }
+      user_map = YastService.Call("YaPI::USERS::UserGet", parameters)
 
 #    system_groups = YastService.Call("YaPI::USERS::GroupsGet", 
{"index"=>["s","cn"],"type"=>["s","system"]})
 #    local_groups = YastService.Call("YaPI::USERS::GroupsGet", 
{"index"=>["s","cn"],"type"=>["s","local"]})
 #    user.allgroups = Hash[*(local_groups.keys | system_groups.keys).collect 
{|v| [v,1]}.flatten]
 
-    raise "Got no data while loading user attributes" if user_map.empty?
+      raise "Got no data while loading user attributes" if user_map.empty?
 
-    user.load_data(user_map)
-    user.uid = id
-    user
+      user.load_data(user_map)
+      user.uid = id
+      user
+    }
   end
 
   # User.destroy("joe")
@@ -103,6 +112,7 @@
 
     ret = YastService.Call("YaPI::USERS::UserDelete", config)
     Rails.logger.debug "Command returns: #{ret}"
+    YastCache.delete(self, uid)
     raise ret if not ret.blank?
     return (ret == "")
   end
@@ -122,6 +132,7 @@
     ret = YastService.Call("YaPI::USERS::UserModify", config, data)
 
     Rails.logger.debug "Command returns: #{ret.inspect}"
+    YastCache.reset(self, id)
     raise ret if not ret.blank?
     true
   end


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to