Author: jsuchome Date: Fri Jun 26 13:58:59 2009 New Revision: 57766 URL: http://svn.opensuse.org/viewcvs/yast?rev=57766&view=rev Log: - YaPI: enable returing set of attributes (UsersGet, UserGet) - 2.18.6 Modified: trunk/users/VERSION trunk/users/package/yast2-users.changes trunk/users/src/YaPI/USERS.pm Modified: trunk/users/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/VERSION?rev=57766&r1=57765&r2=57766&view=diff ============================================================================== --- trunk/users/VERSION (original) +++ trunk/users/VERSION Fri Jun 26 13:58:59 2009 @@ -1 +1 @@ -2.18.5 +2.18.6 Modified: trunk/users/package/yast2-users.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/package/yast2-users.changes?rev=57766&r1=57765&r2=57766&view=diff ============================================================================== --- trunk/users/package/yast2-users.changes (original) +++ trunk/users/package/yast2-users.changes Fri Jun 26 13:58:59 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Jun 26 13:47:50 CEST 2009 - jsuchome@suse.cz + +- YaPI: enable returing set of attributes (UsersGet, UserGet) +- 2.18.6 + +------------------------------------------------------------------- Wed Jun 24 11:37:53 CEST 2009 - jsuchome@suse.cz - in firstboot, allow "Use this password for root" check box Modified: trunk/users/src/YaPI/USERS.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/YaPI/USERS.pm?rev=57766&r1=57765&r2=57766&view=diff ============================================================================== --- trunk/users/src/YaPI/USERS.pm (original) +++ trunk/users/src/YaPI/USERS.pm Fri Jun 26 13:58:59 2009 @@ -108,6 +108,8 @@ # ------------------- imported modules +YaST::YCP::Import ("Mode"); + YaST::YCP::Import ("Ldap"); YaST::YCP::Import ("Users"); YaST::YCP::Import ("UsersLDAP"); @@ -1148,6 +1150,9 @@ my $ret = {}; my $error = ""; + # FIXME HACK to prevent setting mode to testsuite (bnc#243624) + Mode->SetUI ("commandline"); + Users->SetGUI (0); my $type = $config->{"type"} || "local"; @@ -1212,6 +1217,16 @@ } } } + # return only requested attributes... + if ($type eq "local" && $config->{"user_attributes"}) { + my $attrs = {}; + foreach my $key (@{$config->{"user_attributes"}}) { + $attrs->{$key} = 1; + } + foreach my $key (keys %{$ret}) { + delete $ret->{$key} if !$attrs->{$key}; + } + } return $ret; } @@ -1256,6 +1271,9 @@ my $config = $_[0]; my $ret = {}; + # FIXME HACK to prevent setting mode to testsuite (bnc#243624) + Mode->SetUI ("commandline"); + Users->SetGUI (0); my $type = $config->{"type"} || "local"; @@ -1283,7 +1301,21 @@ my $index = $config->{"index"} || "uidNumber"; - return Users->GetUsers ($index, $type); + $ret = Users->GetUsers ($index, $type); + + # return only requested attributes... + if ($type eq "local" && $config->{"user_attributes"}) { + my $attrs = {}; + foreach my $key (@{$config->{"user_attributes"}}) { + $attrs->{$key} = 1; + } + foreach my $user (values %{$ret}) { + foreach my $key (keys %{$user}) { + delete $user->{$key} if !$attrs->{$key}; + } + } + } + return $ret; } =item * -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org