Bugzilla – Attachment 162776 Details for
Bug 36193
CSRF - Code review missed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36193: cud- treatment for restrictions.pl
Bug-36193-cud--treatment-for-restrictionspl.patch (text/plain), 3.17 KB, created by
Nick Clemens (kidclamp)
on 2024-03-05 16:24:44 UTC
(
hide
)
Description:
Bug 36193: cud- treatment for restrictions.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-05 16:24:44 UTC
Size:
3.17 KB
patch
obsolete
>From 7096b61b74a88e80f8ebd8477c4127eb5b594b15 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 5 Mar 2024 11:58:37 -0300 >Subject: [PATCH] Bug 36193: cud- treatment for restrictions.pl > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/restrictions.pl | 4 ++-- > .../prog/en/modules/admin/restrictions.tt | 14 +++++++++++++- > 2 files changed, 15 insertions(+), 3 deletions(-) > >diff --git a/admin/restrictions.pl b/admin/restrictions.pl >index 5ae01ad6f2d..bfeb82c1f16 100755 >--- a/admin/restrictions.pl >+++ b/admin/restrictions.pl >@@ -99,11 +99,11 @@ if ( $op eq 'add_form') { > } > } > $op = 'list'; >-} elsif ( $op eq 'make_default' ) { >+} elsif ( $op eq 'cud-make_default' ) { > my $restriction = Koha::Patron::Restriction::Types->find($code); > $restriction->make_default; > $op = 'list'; >-} elsif ( $op eq 'cud-delete_confirm' ) { >+} elsif ( $op eq 'delete_confirm' ) { > $template->param( > restriction => scalar Koha::Patron::Restriction::Types->find($code) > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt >index fd2910d8e14..0ed1afdc3f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt >@@ -225,7 +225,12 @@ > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&code=[% restriction.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a> > [% END %] > [% IF !restriction.is_system && !restriction.is_default %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=make_default&code=[% restriction.code | uri %]"><i class="fa fa-archive"></i> Make default</a> >+ <form id="make_default_[% restriction.code | html %]" method="post" action="/cgi-bin/koha/admin/restrictions.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-make_default" /> >+ <input type="hidden" name="code" value="[% restriction.code | html %]" /> >+ </form> >+ <a class="btn btn-default btn-xs make_default_button" href="#" data-code="[% restriction.code | html %]"><i class="fa fa-archive"></i> Make default</a> > [% END %] > </td> > </tr> >@@ -270,6 +275,13 @@ > $("#fee_limit").prop("required",false).nextAll().remove(); > } > }); >+ >+ $(".make_default_button").on("click", function(e){ >+ e.preventDefault(); >+ var code = $(this).data('code'); >+ $('#make_default_'+code).submit(); >+ }); >+ > </script> > [% Asset.js("js/restrictiontypes.js") | $raw %] > [% END %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36193
:
162684
|
162733
|
162734
|
162749
|
162750
|
162751
|
162752
|
162755
|
162769
|
162770
|
162771
|
162772
|
162773
|
162774
|
162775
| 162776 |
162777
|
162784
|
162830
|
162831
|
162837