Author: jsuchome Date: Wed Jul 25 15:12:44 2007 New Revision: 39670 URL: http://svn.opensuse.org/viewcvs/yast?rev=39670&view=rev Log: - Write function from plugin API is now called also on deleted users (currently only local) - added universal "plugin_modified" key to check whether user data were modified by plugin Modified: trunk/users/src/Users.pm trunk/users/src/UsersPluginQuota.pm Modified: trunk/users/src/Users.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/Users.pm?rev=39670&r1=39669&r2=39670&view=diff ============================================================================== --- trunk/users/src/Users.pm (original) +++ trunk/users/src/Users.pm Wed Jul 25 15:12:44 2007 @@ -1827,6 +1827,26 @@ if (Autologin->user () eq ($user_in_work{"uid"} || "")) { Autologin->Disable (); } + + my $type = $user_in_work{"type"}; + my $plugins = $user_in_work{"plugins"}; + + # --------- PluginPresent: check which plugins are in use for this user + # so they can be called in "Write" + my $result = UsersPlugins->Apply ("PluginPresent", { + "what" => "user", + "type" => $type, + }, \%user_in_work); + if (defined ($result) && ref ($result) eq "HASH") { + $plugins = []; + foreach my $plugin (keys %{$result}) { + if (bool ($result->{$plugin}) && !contains ($plugins, $plugin)) + { + push @{$plugins}, $plugin; + } + } + $user_in_work{"plugins"} = $plugins; + } return 1; } y2warning ("no such user"); @@ -3301,16 +3321,15 @@ %org_user = %{$user{"org_user"}}; } if ($user{"type"} ne "ldap") { + if (($user{"plugin_modified"} || 0) == 1) { + return 1; #TODO save special plugin_modified global value? + } # grouplist can be ignored, it is a modification of groups while ( my ($key, $value) = each %org_user) { last if $ret; if ($key eq "grouplist") { next; } - if ($key eq "plugin_modified") { - $ret = 1; #TODO save special plugin_modified global value? - next; - } if (defined $user{$key} && (ref ($value) eq "YaST::YCP::Boolean" && ref ($user{$key}) eq "YaST::YCP::Boolean") || @@ -4002,8 +4021,9 @@ } ##------------------------------------ -# remove home directories and -# execute USERDEL_POSTCMD scripts for local/system users which should be deleted +# 1. remove home directories, +# 2. execute USERDEL_POSTCMD scripts for deleted local/system users +# 3. call Write function of plugins to do the delete action sub PostDeleteUsers { my $ret = 1; @@ -4020,11 +4040,20 @@ if (!defined $removed_users{$type}) { next; } + my $plugin_error; foreach my $username (keys %{$removed_users{$type}}) { my %user = %{$removed_users{$type}{$username}}; my $cmd = sprintf ("$userdel_postcmd $username %i %i %s", $user{"uidnumber"}, $user{"gidnumber"}, $user{"homedirectory"}); SCR->Execute (".target.bash", $cmd); + # call the "Write" function from plugins... + my $args = { + "what" => "user", + "type" => $type, + "modified" => "deleted", + }; + my $result = UsersPlugins->Apply ("Write", $args, \%user); + $plugin_error = GetPluginError ($args, $result); }; }; return $ret; Modified: trunk/users/src/UsersPluginQuota.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/users/src/UsersPluginQuota.pm?rev=39670&r1=39669&r2=39670&view=diff ============================================================================== --- trunk/users/src/UsersPluginQuota.pm (original) +++ trunk/users/src/UsersPluginQuota.pm Wed Jul 25 15:12:44 2007 @@ -376,6 +376,9 @@ return YaST::YCP::Boolean (1) if not defined $data->{"quota"}; + # do nothing for user intended for deletion + return YaST::YCP::Boolean (1) if ($config->{"modified"} || "") eq "deleted"; + my $opt = "-u ".$data->{"uid"} if defined $data->{"uid"}; if ($config->{"what"} eq "group") { $opt = "-g ".$data->{"cn"}; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org