Loading classes/JWKSHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace RAP; use phpseclib\Crypt\RSA; /** * Manages the JWT Key Sets (currently only RSA . * Manages the JWT Key Sets (currently only RSA). */ class JWKSHandler { Loading classes/UserSearchResult.phpdeleted 100644 → 0 +0 −88 Original line number Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace RAP; /** * Data model representing an item of the result of an user search. This is used * in order to display the dropdown menu for user selection in the join modal * dialog avoiding exposing the user identifiers in the AJAX calls. * This data is stored into a list inside the SessionData object. The user will * select one of the item by index and not by the user ID. */ class UserSearchResult { // The user object is wrapped by this class and hidden to AJAX. private $user; // Only this text is returned to the AJAX call. // See gui-backend.php (/user?search endpoint) public $userDisplayText; public static function buildFromUser(User $user) { $usr = new UserSearchResult(); $usr->user = $user; $nameAndSurname = null; $email = null; $identityTypes = []; foreach ($user->identities as $identity) { array_push($identityTypes, $identity->getUIType()); if ($nameAndSurname === null && $identity->name !== null && $identity->surname !== null) { $nameAndSurname = $identity->name . ' ' . $identity->surname; } if ($email === null) { $email = $identity->email; } } // Building display text string $displayText = ""; if ($nameAndSurname !== null) { $displayText .= $nameAndSurname; } else { $displayText .= $email; } $displayText .= ' ('; $firstIdentity = true; foreach ($identityTypes as $type) { if (!$firstIdentity) { $displayText .= '+'; } $displayText .= $type; $firstIdentity = false; } $displayText .= ')'; $usr->userDisplayText = $displayText; return $usr; } public function getUser() { return $this->user; } } classes/Util.phpdeleted 100644 → 0 +0 −40 Original line number Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace RAP; /** * Utility class */ class Util { /** * @return string random string */ public static function createNewToken() { // Credits: http://stackoverflow.com/a/18890309/771431 return bin2hex(openssl_random_pseudo_bytes(16)); } } classes/datalayer/OAuth2ClientDAO.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ interface OAuth2ClientDAO { function getOAuth2Clients(): array; function createOAuth2Client($client): OAuth2Client; function createOAuth2Client(OAuth2Client $client): OAuth2Client; function updateOAuth2Client($client): OAuth2Client; function updateOAuth2Client(OAuth2Client $client): OAuth2Client; function deleteOAuth2Client($clientId); Loading classes/datalayer/UserDAO.php +2 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,6 @@ interface UserDAO { * deleted from the database */ function joinUsers($userId1, $userId2); function isAdmin($userId): bool; } Loading
classes/JWKSHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace RAP; use phpseclib\Crypt\RSA; /** * Manages the JWT Key Sets (currently only RSA . * Manages the JWT Key Sets (currently only RSA). */ class JWKSHandler { Loading
classes/UserSearchResult.phpdeleted 100644 → 0 +0 −88 Original line number Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace RAP; /** * Data model representing an item of the result of an user search. This is used * in order to display the dropdown menu for user selection in the join modal * dialog avoiding exposing the user identifiers in the AJAX calls. * This data is stored into a list inside the SessionData object. The user will * select one of the item by index and not by the user ID. */ class UserSearchResult { // The user object is wrapped by this class and hidden to AJAX. private $user; // Only this text is returned to the AJAX call. // See gui-backend.php (/user?search endpoint) public $userDisplayText; public static function buildFromUser(User $user) { $usr = new UserSearchResult(); $usr->user = $user; $nameAndSurname = null; $email = null; $identityTypes = []; foreach ($user->identities as $identity) { array_push($identityTypes, $identity->getUIType()); if ($nameAndSurname === null && $identity->name !== null && $identity->surname !== null) { $nameAndSurname = $identity->name . ' ' . $identity->surname; } if ($email === null) { $email = $identity->email; } } // Building display text string $displayText = ""; if ($nameAndSurname !== null) { $displayText .= $nameAndSurname; } else { $displayText .= $email; } $displayText .= ' ('; $firstIdentity = true; foreach ($identityTypes as $type) { if (!$firstIdentity) { $displayText .= '+'; } $displayText .= $type; $firstIdentity = false; } $displayText .= ')'; $usr->userDisplayText = $displayText; return $usr; } public function getUser() { return $this->user; } }
classes/Util.phpdeleted 100644 → 0 +0 −40 Original line number Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace RAP; /** * Utility class */ class Util { /** * @return string random string */ public static function createNewToken() { // Credits: http://stackoverflow.com/a/18890309/771431 return bin2hex(openssl_random_pseudo_bytes(16)); } }
classes/datalayer/OAuth2ClientDAO.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ interface OAuth2ClientDAO { function getOAuth2Clients(): array; function createOAuth2Client($client): OAuth2Client; function createOAuth2Client(OAuth2Client $client): OAuth2Client; function updateOAuth2Client($client): OAuth2Client; function updateOAuth2Client(OAuth2Client $client): OAuth2Client; function deleteOAuth2Client($clientId); Loading
classes/datalayer/UserDAO.php +2 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,6 @@ interface UserDAO { * deleted from the database */ function joinUsers($userId1, $userId2); function isAdmin($userId): bool; }