Skip to content

Commit

Permalink
Merge branch 'GOCDB:dev' into GT-141-pre-select-site,-services-and-en…
Browse files Browse the repository at this point in the history
…dpoints
  • Loading branch information
Sae126V authored Aug 30, 2023
2 parents 64174f5 + 13386c7 commit f520a18
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 73 deletions.
7 changes: 6 additions & 1 deletion htdocs/web_portal/controllers/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
function search() {
require_once __DIR__.'/../../../lib/Gocdb_Services/Factory.php';


$params = [];
$dn = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($dn);

Expand Down Expand Up @@ -58,11 +58,16 @@ function search() {
$serviceResults = $searchServ->getServices($params['searchTerm']);
$userResults = $searchServ->getUsers($params['searchTerm']);
$ngiResults = $searchServ->getNgis($params['searchTerm']);
$siteIdentifiers = $searchServ->getSiteIdentifiers(
$user,
$params['searchTerm']
);

$params['siteResults'] = $siteResults;
$params['serviceResults'] = $serviceResults;
$params['userResults'] = $userResults;
$params['ngiResults'] = $ngiResults;
$params['siteIdentifiers'] = $siteIdentifiers;

show_view('search_results.php', $params, "Searching for \"{$params['searchTerm']}\"");
}
Expand Down
Binary file added htdocs/web_portal/img/ngi/NGI_LT.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added htdocs/web_portal/img/ngi/fullSize/NGI_LT.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 4 additions & 20 deletions htdocs/web_portal/views/downtime/edit_downtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ class="form-control" id="Select_Sites" name="select_sites" size="10"
$('#startDate').data("DateTimePicker").date("<?php echo date_format($startDate,"d/m/Y"); ?>");
$('#endDate').data("DateTimePicker").date("<?php echo date_format($endDate,"d/m/Y"); ?>");

//Set the start and finish times (don't echo in the full date, just the time values, time widget didn’t like timestamp with date)
$('#startTime').data("DateTimePicker").date("<?php echo date_format($startDate,"H:i"); ?>");
/**
* Set the start and finish times (don't echo in the full date,
* just the time values, time widget didn't like timestamp with date)
*/
$('#endTime').data("DateTimePicker").date("<?php echo date_format($endDate,"H:i"); ?>");

// By default select the original affected services and endpoints
Expand Down Expand Up @@ -654,21 +656,3 @@ function getDate(){
return datesValid;
}*/
</script>


















56 changes: 55 additions & 1 deletion htdocs/web_portal/views/search_results.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,61 @@
</div>
<?php } // end of "if userResults is > 0"?>

<?php if(sizeof($params['siteResults']) == 0 && sizeof($params['serviceResults']) == 0 && sizeof($params['userResults']) == 0 && sizeof($params['ngiResults'] == 0)) { ?>
<!-- Site Idetifiers -->
<?php if (sizeof($params['siteIdentifiers']) > 0) { ?>
<div class="listContainer" style="width: 97%;">
<div style="padding: 0.5em;">
<img style="vertical-align: middle; clear: both; height: 35px; width: 35px;"
src="<?php echo \GocContextPath::getPath()?>img/key.png" />
<h3 style="vertical-align: middle; clear: both; display: inline;
margin-left: 0.3em; font-size: 1.3em; padding-bottom: 0em;">
API credentials
</h3>
</div>

<?php if ($params['authenticated']) { ?>
<table id="usersTable" class="table table-striped table-condensed tablesorter">
<thead>
<tr>
<th>Site Name</th>
<th>Identifier</th>
</tr>
</thead>

<tbody>
<?php
foreach ($params['siteIdentifiers'] as $site) {
?>
<tr>
<td style="width: 25%">
<a href="index.php?Page_Type=Site&amp;id=<?php
echo $site->getParentSite()->getId() ?>">
<?php xecho($site->getParentSite()->getShortName()) ?>
</a>
</td>
<td>
<?php xecho($site->getIdentifier()); ?>
</td>
</tr>
<?php
} // End of the foreach loop iterating over userResults
?>
</tbody>
</table>
<?php } else {
echo 'PROTECTED';
}
?>
</div>
<?php } // end of "if siteIdentifiers is > 0"?>

<?php if (
sizeof($params['siteResults']) == 0 &&
sizeof($params['serviceResults']) == 0 &&
sizeof($params['userResults']) == 0 &&
sizeof($params['ngiResults']) == 0 &&
sizeof($params['siteIdentifiers']) == 0
) { ?>
<div class="listContainer" style="padding: 0.5em; width: 97%;">
<span style="float: left;">No results found</span>
</div>
Expand Down
67 changes: 17 additions & 50 deletions htdocs/web_portal/views/user/link_identity.php
Original file line number Diff line number Diff line change
@@ -1,59 +1,24 @@
<div class="rightPageContainer">
<h1>Link Identity or Recover an Account</h1>

<br />

<h1>Link Identifier or Recover an Account</h1>
<div>
<h2>What is identity linking?</h2>
<ul>
<li>
You can use this process to add your current authentication method as a way to log in to an existing account.
</li>
<li>
This allows access to a single account through two or more identifiers.
</li>
<li>
You must have access to the email address associated with the account being linked.
</li>
<li>
<b>Your current authentication type must be different to any authentication types already associated
with the account being linked.</b>
</li>
</ul>

<h2>What is account recovery?</h2>
<ul>
<li>
If your identifier has changed, you can use this process to update it and regain control of your old account.
</li>
<li>
You must have access to the email address associated with your old account.
</li>
<li>
<b>Your current authentication type must be the same as the authentication type you enter for your old account.</b>
</li>
This page allows you to either add a new identifier to an exisiting GOCDB
account, or recover a GOCDB account if your identifier has changed. You
must have access to the email address associated with that GOCDB account.
You must be authenticated with the new identifier.
</div>

<br />

<div class=Form_Holder>
<div class=Form_Holder_2>
<form name="Link_Identity" action="index.php?Page_Type=Link_Identity"
method="post" class="inputForm" id="linkIdentityForm">
<span>
<div>
Your current ID string (e.g. certificate DN) is: <label><?php echo $params['idString']; ?></label>
</span>
<br />
<span>
</div>
<div>
Your current authentication type is: <label id="currentAuthType"><?php echo $params['currentAuthType']; ?></label>
</span>

<br />
<br />
</div>

<h2>Details of account to be linked or recovered</h2>

<br />
<h2>Details of account to be linked to or recovered</h2>

<div class="form-group" id="authTypeGroup">
<label class="control-label" for="authType">Authentication type *</label>
Expand Down Expand Up @@ -104,8 +69,6 @@ class="form-control"
<br id="idStringPlaceholder" />
</div>

<br />

<div class="form-group" id="emailGroup">
<label class="control-label" for="email">E-mail address *
<label class="input_syntax" >(valid e-mail format)</label>
Expand All @@ -132,12 +95,15 @@ class="form-control"
<li class="hidden" id="linkingDetails"> If you successfully validate your <b>linking</b> request:
<ul>
<li>
Your <b>current ID string</b> and <b>authentication type</b> will be added as an alternative identifier to the account being linked.
Your <b>current ID string</b> and
<b>authentication type</b> will be added as
an alternative identifier to the account
being linked to.
</li>
</li>
<li <?php echo $params['registered'] ? "" : "hidden"; ?>>
Any roles you have with the account you are currently using will be requested
for the account being linked.
for the account being linked to.
</li>
<li <?php echo $params['registered'] ? "" : "hidden"; ?>>
These roles will be approved automatically if either account has permission to do so.
Expand Down Expand Up @@ -191,4 +157,5 @@ class="form-control"
}
</style>

<script type="text/javascript" src="<?php echo \GocContextPath::getPath(); ?>javascript/linking.js"></script>
<script type="text/javascript" src="<?php echo \GocContextPath::getPath(); ?>javascript/linking.js"></script>

19 changes: 18 additions & 1 deletion lib/Gocdb_Services/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,21 @@ public function getNgis($searchTerm) {
return $ngis;
}

}
/**
* When the user is admin, it retrieves the matching identifiers.
*/
public function getSiteIdentifiers($user, $searchTerm)
{
if ($user->isAdmin()) {
$dql = "SELECT ui FROM APIAuthentication ui "
. " WHERE UPPER(ui.identifier) "
. " LIKE UPPER(concat(concat('%', :searchTerm), '%'))";
$siteIdentifiers = $this->em
->createQuery($dql)
->setParameter(":searchTerm", $searchTerm)
->getResult();

return $siteIdentifiers;
}
}
}
6 changes: 6 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
-->
<rule ref="PSR12"/>

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="80"/>
</properties>
</rule>

</ruleset>

0 comments on commit f520a18

Please sign in to comment.