aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2003-07-03 12:55:53 +0000
committerDaouda Lo <daouda@mandriva.com>2003-07-03 12:55:53 +0000
commitdbb8567281472e56a06e46fb326695a3675115a1 (patch)
treeca7f7375658a18e65f6312c38e1b83e5dd513caf
parente8e6477a97da2e68bf753fe12d70d0d363fd4e41 (diff)
downloaduserdrake-dbb8567281472e56a06e46fb326695a3675115a1.tar
userdrake-dbb8567281472e56a06e46fb326695a3675115a1.tar.gz
userdrake-dbb8567281472e56a06e46fb326695a3675115a1.tar.bz2
userdrake-dbb8567281472e56a06e46fb326695a3675115a1.tar.xz
userdrake-dbb8567281472e56a06e46fb326695a3675115a1.zip
- expired status imlementation
-rwxr-xr-xuserdrake21
1 files changed, 15 insertions, 6 deletions
diff --git a/userdrake b/userdrake
index 9ad9122..279190d 100755
--- a/userdrake
+++ b/userdrake
@@ -111,7 +111,7 @@ if (defined $buttorcheck{filter}) {
my $toolb = Gtk2::Toolbar->new;
my $searchBox = Gtk2::HBox->new(0,5);
-$searchBox->pack_end(my $fbut = Gtk2::Button->new("Apply filter"), 0, 0, 4);
+$searchBox->pack_end(my $fbut = Gtk2::Button->new(N("Apply filter")), 0, 0, 4);
$searchBox->pack_end(my $filter = Gtk2::Entry->new, 0, 0, 4);
gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack(create_scrolled_window($usertree)), gtkshow(Gtk2::Label->new(N("Users"))));
gtkappend_page($nb, gtkpack(create_scrolled_window($grouptree)), gtkshow(Gtk2::Label->new(N("Group Users"))));
@@ -166,6 +166,11 @@ sub NotebookSwitch {
my $page = $nb->get_current_page();
TreeUnselect($usertree) ; TreeUnselect($grouptree);
}
+sub ComputeExpire {
+ my $l = shift;
+ my $ep = $l->ShadowExpire($GetValue);
+
+}
sub RefreshUsersFull {
my ($filterusers, $strfilt) = @_;
my ($users, $gid, $group, $groupnm, $expr);
@@ -174,7 +179,7 @@ sub RefreshUsersFull {
my @UserReal;
LOOP: foreach my $l (@$users) { next LOOP if ($filterusers && $l->Uid($GetValue) <= 499 || $l->Uid($GetValue) == 65534) ; push(@UserReal, $l) if $l->UserName($GetValue) =~ /^\Q$strfilt/; };
foreach my $l (@UserReal) {
- $a = $l->Gid($GetValue); $group = $ctx->LookupGroupById($a); $groupnm = ''; $expr = $l->ShadowExpire($GetValue);
+ $a = $l->Gid($GetValue); $group = $ctx->LookupGroupById($a); $groupnm = ''; $expr =
$group and $groupnm = $group->GroupName($GetValue);
$utree_model->append_set([ 0 => $l->UserName($GetValue), 1 => $l->Uid($GetValue), 2 => $groupnm, 3 => $l->Gecos($GetValue), 4 => $l->LoginShell($GetValue), 5 => $l->HomeDir($GetValue), 6 => $ctx->IsLocked($l)?N("Locked"):($expr != -1 ?N("Expired"):'')]);
}
@@ -676,15 +681,14 @@ sub Edit {
my $yr = $us->{o}->{expy}->get_text();
my $mo = $us->{o}->{expm}->get_text();
my $dy = $us->{o}->{expd}->get_text();
- $yr && $dy && $mo or RaiseError(N("Please specify Year, Month and Day \n for Account Expiration "));
- $Exp = ConvTime($dy, $mo, $yr);
- !$error and $userEnt->ShadowExpire($Exp);
+ ValidInt($yr, $dy, $mo) or RaiseError(N("Please specify Year, Month and Day \n for Account Expiration "));
+ if (!$error) { $Exp = ConvTime($dy, $mo, $yr); $userEnt->ShadowExpire($Exp); }
} else { $userEnt->ShadowExpire(ceil(-1)) }
if ($us->{o}->{pcheckexpire}->get_active()) {
my $allowed = int($us->{o}->{dbca}->get_text()); my $required = int($us->{o}->{dbcr}->get_text());
my $warning = int($us->{o}->{bwbc}->get_text()); my $inactive = int($us->{o}->{dbai}->get_text());
- $allowed && $required && $warning && $inactive or RaiseError(N("Please specify all field for password aging"));
+ $allowed && $required && $warning && $inactive or RaiseError(N("Please specify all field for password aging\n"));
if(!$error) {
$userEnt->ShadowMin($allowed); $userEnt->ShadowMax($required);
$userEnt->ShadowWarn($warning); $userEnt->ShadowInact($inactive);
@@ -775,6 +779,11 @@ sub Edit {
});
$w->main
}
+sub ValidInt {
+ my $m = 1;
+ foreach my $i (@_) { $i =~ /\d+/ or $m = 0 and last};
+ return $m;
+}
sub ConvTime {
my ($day, $month, $year) = @_;
my ($tm, $days, $mon, $yr);