Bugzilla – Attachment 74989 Details for
Bug 20624
Disable the OAuth2 client credentials grant by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20624: Make staff client respect RESTOAuth2ClientCredentials
Bug-20624-Make-staff-client-respect-RESTOAuth2Clie.patch (text/plain), 2.94 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-05-02 19:00:39 UTC
(
hide
)
Description:
Bug 20624: Make staff client respect RESTOAuth2ClientCredentials
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-05-02 19:00:39 UTC
Size:
2.94 KB
patch
obsolete
>From 24ad7b13ea20eeb30cf8acae6a7faa69dad796eb Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 2 May 2018 15:55:31 -0300 >Subject: [PATCH] Bug 20624: Make staff client respect > RESTOAuth2ClientCredentials > >This patch makes the staff client UI respect the >RESTOAuth2ClientCredentials syspref. > >To test: >- Make sure RESTOAuth2ClientCredentials is "Don't enable" >- Go to a patron's detail page >=> SUCCESS: The 'More' dropdown doesn't show the API keys management >link. >- Enable RESTOAuth2ClientCredentials >- Reload >=> SUCCESS: The 'More' dropdown shows the API keys management link >- Click on the API keys management link >=> SUCCESS: You can edit the api keys >- Disable the syspref >- Reload >=> SUCCESS: You are presented an error 400 page. >- Sign off :-D >--- > .../intranet-tmpl/prog/en/includes/members-toolbar.inc | 10 ++++++---- > members/apikeys.pl | 3 ++- > 2 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index 0c731b5a00..4ae0e671f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -60,10 +60,12 @@ > <li><a href="/cgi-bin/koha/members/discharge.pl?borrowernumber=[% patron.borrowernumber %]">Discharge</a></li> > [% END %] > >- [% IF CAN_user_borrowers_edit_borrowers %] >- <li><a id="apikeys" href="/cgi-bin/koha/members/apikeys.pl?patron_id=[% patron.borrowernumber %]">Manage API keys</a></li> >- [% ELSE %] >- <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to manage API keys" id="apikeys" href="#">Manage API keys</a></li> >+ [% IF Koha.Preference('RESTOAuth2ClientCredentials') %] >+ [% IF CAN_user_borrowers_edit_borrowers %] >+ <li><a id="apikeys" href="/cgi-bin/koha/members/apikeys.pl?patron_id=[% patron.borrowernumber %]">Manage API keys</a></li> >+ [% ELSE %] >+ <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to manage API keys" id="apikeys" href="#">Manage API keys</a></li> >+ [% END %] > [% END %] > > [% IF ( CAN_user_borrowers ) %] >diff --git a/members/apikeys.pl b/members/apikeys.pl >index 7354fcef66..77c4ce87a5 100755 >--- a/members/apikeys.pl >+++ b/members/apikeys.pl >@@ -45,7 +45,8 @@ my $api_key = $cgi->param('key') // ''; > > $patron = Koha::Patrons->find($patron_id) if $patron_id; > >-if ( not defined $patron ) { >+if ( not defined $patron or >+ not C4::Context->preference('RESTOAuth2ClientCredentials') ) { > > # patron_id invalid -> exit > print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early >-- >2.17.0
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 20624
:
74986
|
74987
|
74988
|
74989
|
75020
|
75021
|
75060
|
75061
|
75062
|
75063
|
75064
|
75065
|
75132
|
75184
|
75206