Add support for ACL to prevent editing of allowed search types

This commit is contained in:
Jamie Cameron
2019-12-08 07:19:15 -08:00
parent c1c9daa212
commit 6e97ba1219
6 changed files with 9 additions and 1 deletions

1
man/defaultacl Normal file
View File

@@ -0,0 +1 @@
allow=1

View File

@@ -62,7 +62,7 @@ print &ui_table_end();
print &ui_form_end([ [ undef, $text{'index_search'} ] ]);
# Form to control search from other modules
if (!$module_info{'usermin'}) {
if (!$module_info{'usermin'} && $access{'allow'}) {
@check = $config{'check'} ? split(/\s+/, $config{'check'}) : @search;
print &ui_hr();
print &ui_form_start("save_check.cgi");

View File

@@ -74,4 +74,8 @@ perl_title=Perl Module
perl_header=Documentation for Perl module $1
perl_emod=Invalid Perl module name
acl_allow=Can edit allowed search types?
check_ecannot=You are not allowed to edit allowed search types
__norefs=1

View File

@@ -10,6 +10,7 @@ if ($module_info{'usermin'}) {
$google_host = "www.google.com";
$google_port = 80;
$google_page = "/search";
%access = &get_module_acl();
# Get the paths to perl and perldoc
$perl_path = &get_perl_path();

1
man/safeacl Normal file
View File

@@ -0,0 +1 @@
allow=0

View File

@@ -4,6 +4,7 @@
# from help_search_link()
require './man-lib.pl';
$access{'allow'} || &error($text{'check_ecannot'});
&ReadParse();
&lock_file("$module_config_directory/config");
@check = split(/\0/, $in{'check'});