granular permissions - updated Tools
Updated all scripts appearing on the tools page to respect a granular permission defined for each of them. The tools menu and home page have been changed so that only the specific tools that a user has access are displayed. This is simple, but depending on the module and circumstance, it may be better to display functions that the user has does not have access to, but disable the links and do some sort of visual styling to indicate that a function exists but requires additional privileges to access. Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
0f7ed0ebb4
commit
fc6ccb1a61
|
|
@ -7,19 +7,49 @@
|
|||
</script>
|
||||
<div id="navmenu"><ul id="navmenulist">
|
||||
<li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools Home</a></li>
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_news" -->
|
||||
<li><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_label_creator" -->
|
||||
<li><a href="/cgi-bin/koha/labels/label-home.pl">Labels (spine and barcode)</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_calendar" -->
|
||||
<li><a href="/cgi-bin/koha/tools/holidays.pl">Calendar</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_notices" -->
|
||||
<li><a href="/cgi-bin/koha/tools/letter.pl">Notices</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_edit_notice_status_triggers" -->
|
||||
<li><a href="/cgi-bin/koha/tools/overduerules.pl">Notice/status triggers</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_moderate_comments" -->
|
||||
<li><a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Moderate OPAC comments</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_view_system_logs" -->
|
||||
<li><a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_inventory" -->
|
||||
<li><a href="/cgi-bin/koha/tools/inventory.pl">Inventory/stocktaking</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_stage_marc_import" -->
|
||||
<li><a href="/cgi-bin/koha/tools/stage-marc-import.pl">MARC Import (staging)</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_manage_staged_marc" -->
|
||||
<li><a href="/cgi-bin/koha/tools/manage-marc-import.pl">MARC Import (managing batches)</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_export_catalog" -->
|
||||
<li><a href="/cgi-bin/koha/tools/export.pl">Export bibs/holdings</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_import_patrons" -->
|
||||
<li><a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_delete_anonymize_patrons" -->
|
||||
<li><a href="/cgi-bin/koha/tools/cleanborrowers.pl">Patrons (anonomize, bulk-delete)</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_batch_upload_patron_images" -->
|
||||
<li><a href="/cgi-bin/koha/tools/picture-upload.pl">Upload Patron Images</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="CAN_user_tools_schedule_tasks" -->
|
||||
<li><a href="/cgi-bin/koha/tools/scheduler.pl">Task Scheduler</a></li>
|
||||
<!-- /TMPL_IF -->
|
||||
</ul></div>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { catalogue => 1 },
|
||||
flagsrequired => { tools => 'moderate_comments' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use CGI::Cookie; # need to check cookies before
|
|||
|
||||
my $input = new CGI;
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => 1 });
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
|
||||
if ($auth_status ne "ok") {
|
||||
my $reply = CGI->new("");
|
||||
print $reply->header(-type => 'text/html');
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
query => $cgi,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1, catalogue => 1 },
|
||||
flagsrequired => { tools => 'delete_anonymize_patrons', catalogue => 1 },
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ else {
|
|||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {tools => 1},
|
||||
flagsrequired => {tools => 'export_catalog'},
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
type => "intranet",
|
||||
query => $input,
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {tools => 1},
|
||||
flagsrequired => {tools => 'edit_calendar'},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1 },
|
||||
flagsrequired => { tools => 'import_patrons' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ my ($template, $borrowernumber, $cookie)
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {tools => 1},
|
||||
flagsrequired => {tools => 'inventory'},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
query => $cgi,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1 },
|
||||
flagsrequired => { tools => 'edit_news' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1 },
|
||||
flagsrequired => { tools => 'edit_notices' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {parameters => 1},
|
||||
flagsrequired => {tools => 'manage_staged_marc'},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {parameters => 1, tools => 1},
|
||||
flagsrequired => {parameters => 1, tools => 'edit_notice_status_triggers'},
|
||||
debug => 1,
|
||||
});
|
||||
my $err=0;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {management => 1, tools => 1},
|
||||
flagsrequired => {management => 1, tools => 'batch_upload_patron_images'},
|
||||
debug => 0,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { editcatalogue => 1 },
|
||||
flagsrequired => { tools => 'schedule_tasks' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {tools => 1},
|
||||
flagsrequired => {tools => 'stage_marc_import'},
|
||||
debug => 1,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1 },
|
||||
flagsrequired => { tools => '*' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use CGI::Cookie; # need to check cookies before
|
|||
# having CGI parse the POST request
|
||||
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => 1 });
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
|
||||
if ($auth_status ne "ok") {
|
||||
my $reply = CGI->new("");
|
||||
print $reply->header(-type => 'text/html');
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use C4::UploadedFile;
|
|||
# have been created.
|
||||
|
||||
my %cookies = fetch CGI::Cookie;
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => 1 });
|
||||
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
|
||||
if ($auth_status ne "ok") {
|
||||
$auth_status = 'denied' if $auth_status eq 'failed';
|
||||
send_reply($auth_status, "");
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { tools => 1 },
|
||||
flagsrequired => { tools => 'view_system_logs' },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue