diff options
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-x | perl-install/standalone/drakperm | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index 9abba28b6..f88b3c989 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -48,6 +48,7 @@ each_index { $permList->append_column($col); } (N("Path"), N("User"), N("Group"), N("Permissions")); +my $index = 0; load_perms(); #- widgets settings @@ -210,7 +211,6 @@ sub save_perm() { } sub load_perms() { - my $index = 0; foreach my $file (@perm_files{($default_perm_level, 'editable')}) { local *F; open F, $file; @@ -315,19 +315,25 @@ sub row_setting_dialog { }); my %perms; $ok->signal_connect(clicked => sub { + my ($path, $user, $group, $perms, $idx); # create new item if needed (that is when adding a new one) at end of list - $iter ||= $model->append; - $model->set($iter, 1 => $file->get_text); + $path = $file->get_text; if ($usr_check->get_active) { - $model->set($iter, 2 => 'current'); - $model->set($iter, 3 => ''); + $user = 'current'; + $group = ''; } else { - $model->set($iter, 2 => $users->entry->get_text); - $model->set($iter, 3 => $groups->entry->get_text); + $user = $users->entry->get_text; + $group = $groups->entry->get_text; } - $model->set($iter, 4 => sprintf("%o", eval(join('', "0b", - (map { $perms{$_}->get_active || 0 } reverse @bits), - (map { my $owner = $_;map_index { $perms{$owner}{$_}->get_active || 0 } @rights } @owners))))); + $perms = sprintf("%o", eval(join('', "0b", + (map { $perms{$_}->get_active || 0 } reverse @bits), + (map { my $owner = $_;map_index { $perms{$owner}{$_}->get_active || 0 } @rights } @owners)))); + if (!$iter) { + $iter = $model->append; + push @rules, { path => $path, user => $user, group => $group, perms => $perms, index => $index }; + $model->set($iter, 5 => $index++); + } + $model->set($iter, 1 => $path, 2 => $user, 3 => $group, 4 => $perms); $dlg->destroy; $modified++; }); |