From 1f747d6e7b35570aa7a696478f2c9f909d854a0f Mon Sep 17 00:00:00 2001 From: Dave MacFarlane Date: Thu, 8 Jun 2023 14:09:47 -0400 Subject: [PATCH] phpcs --- modules/dashboard/jsx/welcome.js | 6 ++--- .../php/projectdescription.class.inc | 22 ++++++++++++++++--- src/Http/Endpoint.php | 5 +++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/modules/dashboard/jsx/welcome.js b/modules/dashboard/jsx/welcome.js index 1cbbb4e6a0c..13ea9300c53 100644 --- a/modules/dashboard/jsx/welcome.js +++ b/modules/dashboard/jsx/welcome.js @@ -1,13 +1,13 @@ import DOMPurify from 'dompurify'; window.addEventListener('load', () => { - fetch(loris.BaseURL + "/dashboard/projectdescription").then ( (resp) => { + fetch(loris.BaseURL + '/dashboard/projectdescription').then( (resp) => { if (!resp.ok) { throw new Error('Could not get project description'); } return resp.json(); - }).then ( (json) => { - const el = document.getElementById("project-description"); + }).then( (json) => { + const el = document.getElementById('project-description'); el.innerHTML = DOMPurify.sanitize(json.Description); }).catch( (e) => console.error(e)); }); diff --git a/modules/dashboard/php/projectdescription.class.inc b/modules/dashboard/php/projectdescription.class.inc index 88ada9ded3f..9af197c8545 100644 --- a/modules/dashboard/php/projectdescription.class.inc +++ b/modules/dashboard/php/projectdescription.class.inc @@ -1,6 +1,5 @@ loris->getConfiguration()->getSetting('projectDescription'); return new \LORIS\Http\Response\JSON\OK(['Description' => $desc]); } - public function _hasAccess(\User $user) { + + /** + * The hasAccess call called by the Module class before loading the page. + * + * @param \User $user The user accessing the page + * + * @return bool + */ + function _hasAccess(\User $user) + { return true; } } diff --git a/src/Http/Endpoint.php b/src/Http/Endpoint.php index ec8d3b7971d..9c33b180eaf 100644 --- a/src/Http/Endpoint.php +++ b/src/Http/Endpoint.php @@ -70,13 +70,14 @@ public function hasAccess(\User $user): bool * This function can be overridden in a module's page to load the necessary * resources to check the permissions of a user. * - * @param User $user The user to load the resources for + * @param \User $user The user to load the resources for * @param ServerRequestInterface $request The PSR15 Request being handled * * @return void */ public function loadResources( - \User $user, ServerRequestInterface $request + \User $user, + ServerRequestInterface $request ) : void { } }