diff --git a/htdocs/web_portal/components/Draw_Components/draw_user_status.php b/htdocs/web_portal/components/Draw_Components/draw_user_status.php index 5ff244271..dc15803fd 100644 --- a/htdocs/web_portal/components/Draw_Components/draw_user_status.php +++ b/htdocs/web_portal/components/Draw_Components/draw_user_status.php @@ -33,7 +33,7 @@ function Get_User_Status_HTML() $HTML .= "Unregistered user
"; $HTML .= "
". "Register
". - "". + "". "Link Identity/Recover Account"; $HTML .=""; @@ -41,7 +41,8 @@ function Get_User_Status_HTML() } $HTML .= "Registered as:
".$user->getForename() . " " . $user->getSurname() . "

"; $HTML .= Get_User_Info_HTML($user); - $HTML .= "
" . "Link Identity/Recover Account
"; + $HTML .= "
"; + $HTML .= "Link Identity/Recover Account
"; $HTML .= ""; return $HTML; } diff --git a/htdocs/web_portal/controllers/user/link_identity.php b/htdocs/web_portal/controllers/user/identifier_management.php similarity index 83% rename from htdocs/web_portal/controllers/user/link_identity.php rename to htdocs/web_portal/controllers/user/identifier_management.php index cfa9ec64a..692d956e5 100644 --- a/htdocs/web_portal/controllers/user/link_identity.php +++ b/htdocs/web_portal/controllers/user/identifier_management.php @@ -5,11 +5,12 @@ require_once __DIR__.'/utils.php'; /** - * Controller for a link identity request. + * Controller for a identifier management request. * @global array $_POST only set if the browser has POSTed data * @return null */ -function link_identity() { +function identifier_management() +{ //Check the portal is not in read only mode, returns exception if it is checkPortalIsNotReadOnly(); @@ -56,12 +57,16 @@ function draw() { $params['otherIdentifiers'][] = $identifier; } } - show_view('user/link_identity_rejected.php', $params); + show_view('user/identifier_management_rejected.php', $params); die(); } } - show_view('user/link_identity.php', $params, 'Link Identity'); + show_view( + 'user/identifier_management.php', + $params, + 'Identifier Management' + ); } function submit() { @@ -89,7 +94,14 @@ function submit() { } try { - \Factory::getLinkIdentityService()->newLinkIdentityRequest($primaryIdString, $currentIdString, $primaryAuthType, $currentAuthType, $givenEmail); + \Factory::getIdentifierManagementService() + ->newIdentifierManagementRequest( + $primaryIdString, + $currentIdString, + $primaryAuthType, + $currentAuthType, + $givenEmail + ); } catch(\Exception $e) { show_view('error.php', $e->getMessage()); die(); @@ -106,5 +118,5 @@ function submit() { $params['requestText'] = 'identity linking'; } - show_view('user/link_identity_accepted.php', $params); -} \ No newline at end of file + show_view('user/identifier_management_accepted.php', $params); +} diff --git a/htdocs/web_portal/controllers/user/link_identity_user_validate.php b/htdocs/web_portal/controllers/user/identifier_management_user_validate.php similarity index 80% rename from htdocs/web_portal/controllers/user/link_identity_user_validate.php rename to htdocs/web_portal/controllers/user/identifier_management_user_validate.php index bc3fe2c7b..a494ab30a 100644 --- a/htdocs/web_portal/controllers/user/link_identity_user_validate.php +++ b/htdocs/web_portal/controllers/user/identifier_management_user_validate.php @@ -24,7 +24,11 @@ function validate_identity_link() { } try { - $request = Factory::getLinkIdentityService()->confirmIdentityLinking($code, $currentIdString); + $request = Factory::getIdentifierManagementService() + ->confirmIdentityLinking( + $code, + $currentIdString + ); } catch(\Exception $e) { show_view('error.php', $e->getMessage()); die(); @@ -37,5 +41,5 @@ function validate_identity_link() { $params['requestText'] = 'linked'; } - show_view('user/linked_identity.php', $params); -} \ No newline at end of file + show_view('user/identifier_management_linked.php', $params); +} diff --git a/htdocs/web_portal/index.php b/htdocs/web_portal/index.php index bd64c6129..ac2838b9f 100644 --- a/htdocs/web_portal/index.php +++ b/htdocs/web_portal/index.php @@ -635,14 +635,15 @@ function Draw_Page($Page_Type) { require_once __DIR__ . '/controllers/site/delete_api_auth.php'; delete_entity(); break; - case "Link_Identity" : + case "Identifier_Management" : rejectIfNotAuthenticated(); - require_once __DIR__ . '/controllers/user/link_identity.php'; - link_identity(); + require_once __DIR__ . '/controllers/user/identifier_management.php'; + identifier_management(); break; case "User_Validate_Identity_Link" : rejectIfNotAuthenticated(); - require_once __DIR__ . '/controllers/user/link_identity_user_validate.php'; + require_once __DIR__ . '/controllers' + . '/user/identifier_management_user_validate.php'; validate_identity_link(); break; default: diff --git a/htdocs/web_portal/javascript/linking.js b/htdocs/web_portal/javascript/linking.js index 860b9c7a9..5193d3215 100644 --- a/htdocs/web_portal/javascript/linking.js +++ b/htdocs/web_portal/javascript/linking.js @@ -1,6 +1,6 @@ $(document).ready(function() { // Add the jQuery form change event handlers - $('#linkIdentityForm').find(":input").change(function() { + $('#identifierManagementForm').find(":input").change(function() { validate(); }); }); diff --git a/htdocs/web_portal/views/user/link_identity.php b/htdocs/web_portal/views/user/identifier_management.php similarity index 96% rename from htdocs/web_portal/views/user/link_identity.php rename to htdocs/web_portal/views/user/identifier_management.php index ff5513281..74e4f2d1f 100644 --- a/htdocs/web_portal/views/user/link_identity.php +++ b/htdocs/web_portal/views/user/identifier_management.php @@ -9,8 +9,13 @@
-
+
Your current ID string (e.g. certificate DN) is:
diff --git a/htdocs/web_portal/views/user/link_identity_accepted.php b/htdocs/web_portal/views/user/identifier_management_accepted.php similarity index 72% rename from htdocs/web_portal/views/user/link_identity_accepted.php rename to htdocs/web_portal/views/user/identifier_management_accepted.php index 2a05753ac..ea99d885b 100644 --- a/htdocs/web_portal/views/user/link_identity_accepted.php +++ b/htdocs/web_portal/views/user/identifier_management_accepted.php @@ -12,6 +12,10 @@ registered to your account. Please follow the instructions contained within it to complete your .

-

If you did not receive an email, please check the above details are correct, and the - guidance on identity linking and account recovery.

+

+ If you did not receive an email, + please check the above details are correct, and the + + guidance on identity linking and account recovery. +

diff --git a/htdocs/web_portal/views/user/linked_identity.php b/htdocs/web_portal/views/user/identifier_management_linked.php similarity index 100% rename from htdocs/web_portal/views/user/linked_identity.php rename to htdocs/web_portal/views/user/identifier_management_linked.php diff --git a/htdocs/web_portal/views/user/link_identity_rejected.php b/htdocs/web_portal/views/user/identifier_management_rejected.php similarity index 100% rename from htdocs/web_portal/views/user/link_identity_rejected.php rename to htdocs/web_portal/views/user/identifier_management_rejected.php diff --git a/lib/Doctrine/bootstrap.php b/lib/Doctrine/bootstrap.php index f2e307944..7c93fbbe1 100644 --- a/lib/Doctrine/bootstrap.php +++ b/lib/Doctrine/bootstrap.php @@ -39,7 +39,7 @@ require_once $entitiesPath."/RoleActionRecord.php"; require_once $entitiesPath."/APIAuthentication.php"; require_once $entitiesPath."/UserIdentifier.php"; -require_once $entitiesPath."/LinkIdentityRequest.php"; +require_once $entitiesPath."/IdentifierManagementRequest.php"; //if (!class_exists("Doctrine\Common\Version", false)) { // require_once __DIR__."/bootstrap_doctrine.php"; diff --git a/lib/Doctrine/entities/LinkIdentityRequest.php b/lib/Doctrine/entities/IdentifierManagementRequest.php similarity index 98% rename from lib/Doctrine/entities/LinkIdentityRequest.php rename to lib/Doctrine/entities/IdentifierManagementRequest.php index 0e2748f5f..0c1c21e2c 100644 --- a/lib/Doctrine/entities/LinkIdentityRequest.php +++ b/lib/Doctrine/entities/IdentifierManagementRequest.php @@ -8,9 +8,9 @@ * a confirmation code that is sent to the user's existing email * address - they need to provide the code to complete the identity linking transaction. * - * @Entity @Table(name="LinkIdentityRequests") + * @Entity @Table(name="IdentifierManagementRequests") */ -class LinkIdentityRequest { +class IdentifierManagementRequest { /** @Id @Column(type="integer") @GeneratedValue */ protected $id; @@ -195,4 +195,4 @@ public function setCurrentAuthType($currentAuthType) { public function setCreationDate($creationDate) { $this->creationDate = $creationDate; } -} \ No newline at end of file +} diff --git a/lib/Gocdb_Services/Factory.php b/lib/Gocdb_Services/Factory.php index 6082d462d..30544fc40 100644 --- a/lib/Gocdb_Services/Factory.php +++ b/lib/Gocdb_Services/Factory.php @@ -48,7 +48,7 @@ class Factory { private static $exService = null; private static $notificationService = null; private static $emailService = null; - private static $linkIdentityService = null; + private static $identifierManagementService = null; private static $APIAuthenticationService = null; public static $properties = array(); @@ -349,16 +349,21 @@ public static function getProjectService() { } /** - * Singleton Link Identity service - * @return org\gocdb\services\LinkIdentity + * Singleton Identifier Management service + * @return org\gocdb\services\IdentifierManagement */ - public static function getLinkIdentityService() { - if (self::$linkIdentityService == null) { - require_once __DIR__ . '/LinkIdentity.php'; - self::$linkIdentityService = new org\gocdb\services\LinkIdentity(); - self::$linkIdentityService->setEntityManager(self::getEntityManager()); + public static function getIdentifierManagementService() + { + if (self::$identifierManagementService == null) { + require_once __DIR__ . '/IdentifierManagement.php'; + + self::$identifierManagementService = new org\gocdb\services\IdentifierManagement(); + self::$identifierManagementService->setEntityManager( + self::getEntityManager() + ); } - return self::$linkIdentityService; + + return self::$identifierManagementService; } /** diff --git a/lib/Gocdb_Services/LinkIdentity.php b/lib/Gocdb_Services/IdentifierManagement.php similarity index 94% rename from lib/Gocdb_Services/LinkIdentity.php rename to lib/Gocdb_Services/IdentifierManagement.php index 64b365033..4006b0436 100644 --- a/lib/Gocdb_Services/LinkIdentity.php +++ b/lib/Gocdb_Services/IdentifierManagement.php @@ -2,7 +2,7 @@ namespace org\gocdb\services; require_once __DIR__ . '/AbstractEntityService.php'; -class LinkIdentity extends AbstractEntityService { +class IdentifierManagement extends AbstractEntityService { /** * Processes an identity link request @@ -12,7 +12,13 @@ class LinkIdentity extends AbstractEntityService { * @param string $currentAuthType auth type of current ID string * @param string $givenEmail email of primary user */ - public function newLinkIdentityRequest($primaryIdString, $currentIdString, $primaryAuthType, $currentAuthType, $givenEmail) { + public function newIdentifierManagementRequest( + $primaryIdString, + $currentIdString, + $primaryAuthType, + $currentAuthType, + $givenEmail + ) { $serv = \Factory::getUserService(); @@ -46,8 +52,16 @@ public function newLinkIdentityRequest($primaryIdString, $currentIdString, $prim // Generate confirmation code $code = $this->generateConfirmationCode($primaryIdString); - // Create link identity request - $linkIdentityReq = new \LinkIdentityRequest($primaryUser, $currentUser, $code, $primaryIdString, $currentIdString, $primaryAuthType, $currentAuthType); + // Create identifier management request + $identifierManagementReq = new \IdentifierManagementRequest( + $primaryUser, + $currentUser, + $code, + $primaryIdString, + $currentIdString, + $primaryAuthType, + $currentAuthType + ); // Recovery or identity linking if ($currentUser === null) { @@ -59,7 +73,7 @@ public function newLinkIdentityRequest($primaryIdString, $currentIdString, $prim // Apply change try { $this->em->getConnection()->beginTransaction(); - $this->em->persist($linkIdentityReq); + $this->em->persist($identifierManagementReq); $this->em->flush(); // Send confirmation email(s) to primary user, and current user if registered with a different email @@ -172,13 +186,13 @@ private function generateConfirmationCode($idString) { } /** - * Gets a link identity request from the database based on user ID + * Gets a identifier management request from the database based on user ID * @param integer $userId userid of the request to be linked * @return arraycollection */ private function getRequestByUserId($userId) { $dql = "SELECT l - FROM LinkIdentityRequest l + FROM IdentifierManagementRequest l JOIN l.primaryUser pu JOIN l.currentUser cu WHERE pu.id = :id OR cu.id = :id"; @@ -192,14 +206,16 @@ private function getRequestByUserId($userId) { } /** - * Gets a link identity request from the database based on current ID string + * Gets a identifier management request from the database + * based on current ID string. + * * ID string may be present as primary or current user * @param string $idString ID string of user to be linked in primary account * @return arraycollection */ private function getRequestByIdString($idString) { $dql = "SELECT l - FROM LinkIdentityRequest l + FROM IdentifierManagementRequest l WHERE l.primaryIdString = :idString OR l.currentIdString = :idString"; @@ -218,7 +234,7 @@ private function getRequestByIdString($idString) { */ public function getRequestByConfirmationCode($code) { $dql = "SELECT l - FROM LinkIdentityRequest l + FROM IdentifierManagementRequest l WHERE l.confirmCode = :code"; $request = $this->em diff --git a/resources/DeleteOldRequestsRunner.php b/resources/DeleteOldRequestsRunner.php index 6f4e44706..8828293a5 100644 --- a/resources/DeleteOldRequestsRunner.php +++ b/resources/DeleteOldRequestsRunner.php @@ -10,7 +10,7 @@ echo "Querying identity linking and account recovery requests\n\n"; $em = $entityManager; -$dql = "SELECT l FROM LinkIdentityRequest l"; +$dql = "SELECT l FROM IdentifierManagementRequest l"; $requests = $entityManager->createQuery($dql)->getResult(); // Remove requests older than one day diff --git a/tests/doctrine/bootstrap.php b/tests/doctrine/bootstrap.php index 240de9c88..c80c53ca4 100644 --- a/tests/doctrine/bootstrap.php +++ b/tests/doctrine/bootstrap.php @@ -26,7 +26,7 @@ require_once $entitiesPath."/Project.php"; require_once $entitiesPath."/ServiceGroup.php"; require_once $entitiesPath."/ServiceGroupProperty.php"; -require_once $entitiesPath."/LinkIdentityRequest.php"; +require_once $entitiesPath."/IdentifierManagementRequest.php"; require_once $entitiesPath."/PrimaryKey.php"; require_once $entitiesPath."/ArchivedNGI.php"; require_once $entitiesPath."/ArchivedService.php"; diff --git a/tests/doctrine/truncateDataTables.xml b/tests/doctrine/truncateDataTables.xml index 0380b72bf..db48b3c4b 100644 --- a/tests/doctrine/truncateDataTables.xml +++ b/tests/doctrine/truncateDataTables.xml @@ -71,7 +71,7 @@ - +