From 449b885ef7f2d885afb651f50aaecc9e58d12bb5 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 16 Dec 2013 17:11:16 -0800 Subject: [PATCH] ui-lib conversion and perl niceness --- acl/edit_sync.cgi | 38 ++++++++++++++++++++------------------ acl/lang/en | 1 + acl/save_sync.cgi | 3 +++ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/acl/edit_sync.cgi b/acl/edit_sync.cgi index 520e6da00..599a8ab85 100755 --- a/acl/edit_sync.cgi +++ b/acl/edit_sync.cgi @@ -2,37 +2,39 @@ # edit_sync.cgi # Display unix/webmin user synchronization +use strict; +use warnings; require './acl-lib.pl'; +our (%in, %text, %config, %access); $access{'sync'} && $access{'create'} && $access{'delete'} || &error($text{'sync_ecannot'}); &ui_print_header(undef, $text{'sync_title'}, ""); -@glist = &list_groups(); +my @glist = &list_groups(); if (!@glist) { print "

$text{'sync_nogroups'}

\n"; &ui_print_footer("", $text{'index_return'}); exit; } -print "

\n"; -print "$text{'sync_desc'}

\n"; -printf " %s

\n", - $config{'sync_create'} ? "checked" : "", $text{'sync_create'}; -printf " %s

\n", - $config{'sync_delete'} ? "checked" : "", $text{'sync_delete'}; -printf " %s

\n", - $config{'sync_unix'} ? "checked" : "", $text{'sync_unix'}; +print &ui_form_start("save_sync.cgi"); +print &ui_table_start(undef, undef, 2); -print "$text{'sync_group'}

\n"; +# Sync on creation / deletion +print &ui_table_row($text{'sync_when'}, + &ui_checkbox("create", 1, $text{'sync_create'}, $config{'sync_create'}). + "
\n". + &ui_checkbox("delete", 1, $text{'sync_delete'}, $config{'sync_delete'}). + "
\n". + &ui_checkbox("unix", 1, $text{'sync_unix'}, $config{'sync_unix'})); -print "

\n"; +# Assign new users to group +print &ui_table_row($text{'sync_group'}, + &ui_select("group", $config{'sync_group'}, + [ map { $_->{'name'} } @glist ])); + +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'save'} ] ]); &ui_print_footer("", $text{'index_return'}); diff --git a/acl/lang/en b/acl/lang/en index 82227467f..2bc5e935f 100644 --- a/acl/lang/en +++ b/acl/lang/en @@ -292,6 +292,7 @@ convert_users=Users to convert sync_title=Unix User Synchronization sync_desc=This form allows you to configure the automatic synchronization of Unix users created through Webmin and users in this module. sync_nogroups=No Webmin groups have been defined on your system. At least one group must be created to set the access for created users. +sync_when=When to synchronize sync_create=Create a Webmin user when a Unix user is created. sync_update=Update the matching Webmin user when a Unix user is updated. sync_delete=Delete the matching Webmin user when a Unix user is deleted. diff --git a/acl/save_sync.cgi b/acl/save_sync.cgi index 7bef16151..3a4fba59d 100755 --- a/acl/save_sync.cgi +++ b/acl/save_sync.cgi @@ -2,7 +2,10 @@ # save_sync.cgi # Save unix/webmin user synchronization +use strict; +use warnings; require './acl-lib.pl'; +our (%in, %text, %config, %access, $module_config_directory); &ReadParse(); $access{'sync'} && $access{'create'} && $access{'delete'} || &error($text{'sync_ecannot'});