From 34adb970bcc7f9d4d2ec8d8756a889e7027226bb Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Date: Wed, 25 Sep 2024 15:18:38 +0000 Subject: [PATCH] Bug 38010: Add permissions to action buttons --- .../components/Vendors/VendorContracts.vue | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue index 43adfba7cca..9ad2e0c709f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue @@ -78,24 +78,30 @@ export default { searchable: false, orderable: false, }, - { - title: __("Actions"), - data: "contractnumber", - searchable: false, - orderable: false, - render: function (data, type, row, meta) { - return ( - `<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-pencil" aria-hidden="true"></i>` + - " " + - __("Edit") + - "</a>" + - `<a style="margin-left: 5px;" class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-trash-can" aria-hidden="true"></i>` + - " " + - __("Delete") + - "</a>" - ) - }, - }, + ...(isUserPermitted( + "CAN_user_acquisition_contracts_manage" + ) + ? [ + { + title: __("Actions"), + data: "contractnumber", + searchable: false, + orderable: false, + render: function (data, type, row, meta) { + return ( + `<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-pencil" aria-hidden="true"></i>` + + " " + + __("Edit") + + "</a>" + + `<a style="margin-left: 5px;" class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=${row.contractnumber}&booksellerid=${row.booksellerid}"><i class="fa-solid fa-trash-can" aria-hidden="true"></i>` + + " " + + __("Delete") + + "</a>" + ) + }, + }, + ] + : []), ], }) ) -- 2.39.3 (Apple Git-146)