Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-users for openSUSE:Factory 
checked in at 2021-10-20 20:23:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-users (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-users.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-users"

Wed Oct 20 20:23:03 2021 rev:247 rq:926204 version:4.4.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-users/yast2-users.changes  2021-08-16 
10:12:53.203006935 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-users.new.1890/yast2-users.changes        
2021-10-20 20:23:31.385349882 +0200
@@ -1,0 +2,9 @@
+Tue Oct 19 08:50:07 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- The shadow tools are used for reading the useradd default values
+  (bsc#1190864).
+- Unsupported useradd attributes (i.e., skel and groups) are
+  removed from the UI.
+- 4.4.7
+
+-------------------------------------------------------------------

Old:
----
  yast2-users-4.4.6.tar.bz2

New:
----
  yast2-users-4.4.7.tar.bz2

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

Other differences:
------------------
++++++ yast2-users.spec ++++++
--- /var/tmp/diff_new_pack.SlAZSP/_old  2021-10-20 20:23:32.689350686 +0200
+++ /var/tmp/diff_new_pack.SlAZSP/_new  2021-10-20 20:23:32.689350686 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-users
-Version:        4.4.6
+Version:        4.4.7
 Release:        0
 Summary:        YaST2 - User and Group Configuration
 License:        GPL-2.0-only

++++++ yast2-users-4.4.6.tar.bz2 -> yast2-users-4.4.7.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/.github/workflows/ci.yml 
new/yast2-users-4.4.7/.github/workflows/ci.yml
--- old/yast2-users-4.4.6/.github/workflows/ci.yml      2021-08-12 
18:05:37.000000000 +0200
+++ new/yast2-users-4.4.7/.github/workflows/ci.yml      2021-10-19 
12:23:29.000000000 +0200
@@ -7,7 +7,9 @@
 jobs:
   Tests:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -32,7 +34,9 @@
 
   Rubocop:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -44,7 +48,9 @@
 
   Package:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-cpp:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-cpp:latest
+      options: --privileged
 
     steps:
 
@@ -72,7 +78,9 @@
 
   Yardoc:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -84,7 +92,9 @@
 
   Checks:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/package/yast2-users.changes 
new/yast2-users-4.4.7/package/yast2-users.changes
--- old/yast2-users-4.4.6/package/yast2-users.changes   2021-08-12 
18:05:37.000000000 +0200
+++ new/yast2-users-4.4.7/package/yast2-users.changes   2021-10-19 
12:23:29.000000000 +0200
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Tue Oct 19 08:50:07 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- The shadow tools are used for reading the useradd default values
+  (bsc#1190864).
+- Unsupported useradd attributes (i.e., skel and groups) are
+  removed from the UI.
+- 4.4.7
+
+-------------------------------------------------------------------
 Thu Aug 12 14:35:20 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
 
 - Allow to edit the name of an existing user (bsc#1188612).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/package/yast2-users.spec 
new/yast2-users-4.4.7/package/yast2-users.spec
--- old/yast2-users-4.4.6/package/yast2-users.spec      2021-08-12 
18:05:37.000000000 +0200
+++ new/yast2-users-4.4.7/package/yast2-users.spec      2021-10-19 
12:23:29.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-users
-Version:        4.4.6
+Version:        4.4.7
 Release:        0
 Summary:        YaST2 - User and Group Configuration
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/src/Makefile.am 
new/yast2-users-4.4.7/src/Makefile.am
--- old/yast2-users-4.4.6/src/Makefile.am       2021-08-12 18:05:37.000000000 
+0200
+++ new/yast2-users-4.4.7/src/Makefile.am       2021-10-19 12:23:29.000000000 
+0200
@@ -14,7 +14,8 @@
   modules/UsersPluginLDAPAll.pm \
   modules/UsersPluginLDAPPasswordPolicy.pm \
   modules/UsersPluginKerberos.pm \
-  modules/UsersPasswd.pm
+  modules/UsersPasswd.pm \
+  modules/Y2UsersLinux.rb
 
 module1dir = @moduledir@/YaPI
 module1_DATA = \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/src/include/users/helps.rb 
new/yast2-users-4.4.7/src/include/users/helps.rb
--- old/yast2-users-4.4.6/src/include/users/helps.rb    2021-08-12 
18:05:37.000000000 +0200
+++ new/yast2-users-4.4.7/src/include/users/helps.rb    2021-10-19 
12:23:29.000000000 +0200
@@ -112,13 +112,6 @@
             "The group name of a new user's primary group.\n" +
             "</p>\n"
         ) +
-        # Help text 1.5/6
-        _(
-          "<p>\n" +
-            "<b>Secondary Groups</b><br>\n" +
-            "Names of additional groups to which to assign new users.\n" +
-            "</p>\n"
-        ) +
         # Help text 2/6
         _(
           "<p><b>Default Login Shell</b><br>\nThe name of the new user's login 
shell. Select one from the list or enter your own path to the shell.</P>\n"
@@ -130,10 +123,6 @@
             "to the end of this value to create the default name of the home 
directory.\n" +
             "</P>\n"
         ) +
-        # Help text 4/6
-        _(
-          "<p><b>Skeleton Directory</b><br>\nThe contents of this directory 
are copied to a user's home directory when a new user is added. </p>\n"
-        ) +
         # Help text 4.5/6
         _(
           "<p><b>Umask for Home Directory</b><br>\nUmask to use for creating 
new home directories.</p>\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/src/include/users/widgets.rb 
new/yast2-users-4.4.7/src/include/users/widgets.rb
--- old/yast2-users-4.4.6/src/include/users/widgets.rb  2021-08-12 
18:05:37.000000000 +0200
+++ new/yast2-users-4.4.7/src/include/users/widgets.rb  2021-10-19 
12:23:29.000000000 +0200
@@ -142,7 +142,7 @@
         "samba"    => _("Samba")
       }
 
-      # auth methods and respective module calls 
+      # auth methods and respective module calls
       @auth_methods = {
         "nis" => {
           # menubutton label
@@ -195,10 +195,8 @@
               VSpacing(0.2),
               "defaults_global",
               "defaultgroup",
-              "groups",
               "shell",
               HBox("home", VBox(Label(""), "browse_home")),
-              HBox("skel", VBox(Label(""), "browse_skel")),
               "umask",
               "expire",
               "inactive",
@@ -210,12 +208,9 @@
           "widget_names" => [
             "defaults_global",
             "defaultgroup",
-            "groups",
             "shell",
             "home",
             "browse_home",
-            "skel",
-            "browse_skel",
             "umask",
             "expire",
             "inactive"
@@ -340,17 +335,6 @@
             "boolean (string, map)"
           )
         },
-        "groups"            => {
-          "widget"            => :textentry,
-          # text entry
-          "label"             => _("Se&condary Groups"),
-          "no_help"           => true,
-          "validate_type"     => :function,
-          "validate_function" => fun_ref(
-            method(:ValidateGroupList),
-            "boolean (string, map)"
-          )
-        },
         "home"              => {
           "widget"            => :textentry,
           # text entry
@@ -375,28 +359,6 @@
           ),
           "no_help" => true
         },
-        "skel"              => {
-          "widget"            => :textentry,
-          # text entry
-          "label"             => _("&Skeleton for Home Directory"),
-          "no_help"           => true,
-          "validate_type"     => :function,
-          "validate_function" => fun_ref(
-            method(:ValidateSkeleton),
-            "boolean (string, map)"
-          )
-        },
-        "browse_skel"       => {
-          "widget"  => :push_button,
-          # push button label
-          "label"   => _("Bro&wse..."),
-          "opt"     => [:key_F7],
-          "handle"  => fun_ref(
-            method(:HandleBrowseDirectory),
-            "symbol (string, map)"
-          ),
-          "no_help" => true
-        },
         "expire"            => {
           "widget"            => :textentry,
           # text entry
@@ -1667,23 +1629,6 @@
       true
     end
 
-    # Validation function for home directory skeleton directory
-    def ValidateSkeleton(key, event)
-      event = deep_copy(event)
-      new_skel = Convert.to_string(UI.QueryWidget(Id(key), :Value))
-      if SCR.Read(path(".target.dir"), new_skel) == nil
-        # popup error label
-        Report.Error(
-          _(
-            "The entered home directory skeleton is not a directory.\nTry 
again.\n"
-          )
-        )
-        UI.SetFocus(Id(key))
-        return false
-      end
-      true
-    end
-
     # Validation function for the default home prefix
     def ValidateHomePrefix(key, event)
       event = deep_copy(event)
@@ -1717,57 +1662,6 @@
       true
     end
 
-    # Validation function for the value of the default list of groups
-    def ValidateGroupList(key, event)
-      event = deep_copy(event)
-      groups = Users.GetDefaultGrouplist("local")
-      grouplist = Builtins.mergestring(Builtins.maplist(groups) { |g, i| g }, 
",")
-      new_grouplist = Convert.to_string(UI.QueryWidget(Id(key), :Value))
-
-      if new_grouplist != grouplist
-        l_grouplist = []
-        dont_exist = []
-        Builtins.foreach(Builtins.splitstring(new_grouplist, ",")) do |g|
-          # check for group existence
-          if Ops.get(@all_groupnames, ["local", g], 0) == 0 &&
-              Ops.get(@all_groupnames, ["system", g], 0) == 0
-            dont_exist = Convert.convert(
-              Builtins.union(dont_exist, [g]),
-              :from => "list",
-              :to   => "list <string>"
-            )
-          else
-            # filter out the duplicates
-            l_grouplist = Convert.convert(
-              Builtins.union(l_grouplist, [g]),
-              :from => "list",
-              :to   => "list <string>"
-            )
-          end
-        end
-        if dont_exist != []
-          # error message
-          Report.Error(
-            Builtins.sformat(
-              _(
-                "These groups do not exist in your system:\n" +
-                  "%1\n" +
-                  "Try again.\n"
-              ),
-              Builtins.mergestring(dont_exist, ",")
-            )
-          )
-
-          UI.SetFocus(Id("groups"))
-          return false
-        end
-        new_grouplist = Builtins.mergestring(l_grouplist, ",")
-        UI.ChangeWidget(Id("groups"), :Value, new_grouplist)
-      end
-      true
-    end
-
-    # Validation function for the default login shell
     def ValidateShell(key, event)
       event = deep_copy(event)
       new_shell = Convert.to_string(UI.QueryWidget(Id(key), :Value))
@@ -1804,19 +1698,11 @@
       UI.ChangeWidget(Id("shell"), :Items, Users.AllShells)
       UI.ChangeWidget(Id("shell"), :Value, Users.GetDefaultShell("local"))
 
-      groups = Users.GetDefaultGrouplist("local")
-      grouplist = Builtins.mergestring(Builtins.maplist(groups) { |g, i| g }, 
",")
-      UI.ChangeWidget(Id("groups"), :Value, grouplist)
       UI.ChangeWidget(
         Id("home"),
         :Value,
         Ops.get_string(defaults, "home", "/home")
       )
-      UI.ChangeWidget(
-        Id("skel"),
-        :Value,
-        Ops.get_string(defaults, "skel", "/etc/skel")
-      )
 
       UI.ChangeWidget(
         Id("inactive"),
@@ -1851,20 +1737,13 @@
       event = deep_copy(event)
       defaults = Users.GetLoginDefaults
       new_defaults = {}
-      Builtins.foreach(["home", "shell", "skel", "inactive", "umask"]) do 
|key2|
+      Builtins.foreach(["home", "shell", "inactive", "umask"]) do |key2|
         val = UI.QueryWidget(Id(key2), :Value)
         val = Builtins.sformat("%1", val) if Ops.is_integer?(val)
         if Ops.get(defaults, key2) != val
           Ops.set(new_defaults, key2, Convert.to_string(val))
         end
       end
-      new_grouplist = Convert.to_string(UI.QueryWidget(Id("groups"), :Value))
-      if Builtins.sort(
-          Builtins.splitstring(Ops.get_string(defaults, "groups", ""), ",")
-        ) !=
-          Builtins.sort(Builtins.splitstring(new_grouplist, ","))
-        Ops.set(new_defaults, "groups", new_grouplist)
-      end
 
       new_exp_date = Convert.to_string(UI.QueryWidget(Id("expire"), :Value))
       new_expire = Ops.get_string(defaults, "expire", "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/src/modules/Users.pm 
new/yast2-users-4.4.7/src/modules/Users.pm
--- old/yast2-users-4.4.6/src/modules/Users.pm  2021-08-12 18:05:37.000000000 
+0200
+++ new/yast2-users-4.4.7/src/modules/Users.pm  2021-10-19 12:23:29.000000000 
+0200
@@ -251,6 +251,7 @@
 YaST::YCP::Import ("UsersSimple");
 YaST::YCP::Import ("UsersUI");
 YaST::YCP::Import ("SSHAuthorizedKeys");
+YaST::YCP::Import ("Y2UsersLinux");
 YaST::YCP::Import ("Nsswitch");
 
 ##-------------------------------------------------------------------------
@@ -1380,14 +1381,16 @@
 BEGIN { $TYPEINFO{ReadLoginDefaults} = ["function", "boolean"]; }
 sub ReadLoginDefaults {
 
-    my $self           = shift;
-    foreach my $key (sort keys %useradd_defaults) {
-        my $entry = SCR->Read (".etc.default.useradd.\"\Q$key\E\"");
-        # use the defaults set in this file if $entry not defined
-        next if !defined $entry;
-       $entry =~ s/\"//g;
-        $useradd_defaults{$key} = $entry;
-    }
+    my $self = shift;
+
+    my %defaults = %{Y2UsersLinux->read_useradd_config()};
+
+    $useradd_defaults{"home"} = $defaults{"home"};
+    $useradd_defaults{"group"} = $defaults{"group"};
+    $useradd_defaults{"umask"} = $defaults{"umask"};
+    $useradd_defaults{"expire"} = $defaults{"expiration"};
+    $useradd_defaults{"inactive"} = $defaults{"inactivity_period"};
+    $useradd_defaults{"shell"} = $defaults{"shell"};
 
     UsersLDAP->InitConstants (\%useradd_defaults);
     UsersLDAP->SetDefaultShadow ($self->GetDefaultShadow ("local"));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-users-4.4.6/src/modules/Y2UsersLinux.rb 
new/yast2-users-4.4.7/src/modules/Y2UsersLinux.rb
--- old/yast2-users-4.4.6/src/modules/Y2UsersLinux.rb   1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-users-4.4.7/src/modules/Y2UsersLinux.rb   2021-10-19 
12:23:29.000000000 +0200
@@ -0,0 +1,48 @@
+# Copyright (c) [2021] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "yast"
+require "y2users/linux/useradd_config_reader"
+
+module Yast
+  # Module to make possible for Yast::Users to use some of the Y2Users::Linux 
components, like
+  # the {Y2Users::Linux::UseraddConfigReader}
+  class Y2UsersLinuxClass < Module
+    EXPORTED_USERADD_ATTRS =
+      ["group", "home", "inactivity_period", "expiration", "shell", 
"umask"].freeze
+    private_constant :EXPORTED_USERADD_ATTRS
+
+    # Reads the defaults for useradd
+    #
+    # These values are used by {Yast::Users} for initializing the UI fields
+    #
+    # @return [Hash<String, String>]
+    def read_useradd_config
+      useradd_config = Y2Users::Linux::UseraddConfigReader.new.read
+
+      EXPORTED_USERADD_ATTRS.each_with_object({}) do |attr, result|
+        result[attr] = useradd_config.public_send(attr) || ""
+      end
+    end
+
+    publish function: :read_useradd_config, type: "map ()"
+  end
+
+  Y2UsersLinux = Y2UsersLinuxClass.new
+end

Reply via email to