From 926ff99773475e273210195ca09897c2e0915362 Mon Sep 17 00:00:00 2001 From: Daouda Lo Date: Thu, 5 Jun 2003 17:18:59 +0000 Subject: - delete group when deleting user --- userdrake2 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'userdrake2') diff --git a/userdrake2 b/userdrake2 index 8c092f7..7816e6d 100755 --- a/userdrake2 +++ b/userdrake2 @@ -118,7 +118,6 @@ foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(0) }; my $ctx = USER::ADMIN->new; Refresh($sysfilter); $nb->signal_connect('switch-page' => sub { NotebookSwitch() }); -#GetEvent($usertree); GetEvent($grouptree); $us->{wnd}{rwindow}->show_all; Gtk2->main; ugtk2->exit; @@ -344,21 +343,29 @@ sub AddGroup { $w->main; } - sub Delete { my $page = $nb->get_current_page(); if ($page == 0) { - print "page 0"; + my (undef, $iter) = $usertree->get_selection->get_selected; + my $username = $utree_model->get($iter,0); + $iter->free; + my $userEnt = $ctx->LookupUserByName($username); + $ctx->UserDel($userEnt); + my $groups = $ctx->GroupsEnumerateFull(); + Refresh($sysfilter) } elsif ($page == 1) { - print "page 1\n"; + my (undef, $iter) = $grouptree->get_selection->get_selected; + my $groupname = $gtree_model->get($iter,0); + my $groupEnt = $ctx->LookupGroupByName($groupname); + + $iter->free } - } # Gtk Facilities sub CreateTree { my ($tree_model) = @_; my $tree = Gtk2::TreeView->new_with_model($tree_model); - $tree->get_selection->set_mode('single'); + $tree->get_selection->set_mode('browse'); $tree->set_headers_visible(1); $tree->set_rules_hint(1); $tree->get_selection->signal_connect('changed' => sub { foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(1);} }); -- cgit v1.2.1