Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 9de4820

Browse files
author
Dominik František Bučík
authored
Merge pull request #263 from dBucik/stats_hide_prot
feat: 🎸 Possibility to hide authN protocol, small fixes
2 parents 8700aca + 635ea64 commit 9de4820

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

templates/listOfSps-tpl.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@
110110
<thead>
111111
<tr>
112112
<th><?php echo $this->t('{perun:listOfSps:name}'); ?></th>
113-
<th><?php echo $this->t('{perun:listOfSps:authenticate_protocol}'); ?></th>
114113
<?php
114+
if ($this->data['showProtocol']) {
115+
echo '<th>' . $this->t('{perun:listOfSps:authenticate_protocol}') . '</th>' . PHP_EOL;
116+
}
115117
foreach ($attributesToShow as $attr) {
116118
if (!empty($samlServices)) {
117-
echo "<th class='" . ListOfSps::getClass(
118-
array_values($samlServices)[0]['facilityAttributes'][$attr]['type']
119-
) . "'>" . array_values($samlServices)[0]['facilityAttributes'][$attr]['displayName']
120-
. '</th>';
119+
$displayName = array_values(
120+
$samlServices
121+
)[0]['facilityAttributes'][$attr]['displayName'];
122+
echo '<th>' . $displayName . '</th>';
121123
}
122124
}
123125
?>
@@ -138,10 +140,12 @@
138140
$service['loginURL']['value'] ?? null
139141
)
140142
. '</td>';
141-
if (array_key_exists($service['facility']->getID(), $samlServices)) {
142-
echo '<td>' . $this->t('{perun:listOfSps:saml}') . '</td>';
143-
} else {
144-
echo '<td>' . $this->t('{perun:listOfSps:oidc}') . '</td>';
143+
if ($this->data['showProtocol']) {
144+
if (array_key_exists($service['facility']->getID(), $samlServices)) {
145+
echo '<td>' . $this->t('{perun:listOfSps:saml}') . '</td>';
146+
} else {
147+
echo '<td>' . $this->t('{perun:listOfSps:oidc}') . '</td>';
148+
}
145149
}
146150
foreach ($attributesToShow as $attr) {
147151
$type = $service['facilityAttributes'][$attr]['type'];

www/listOfSps.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
const PERUN_LOGIN_URL_ATTR_NAME = 'listOfSps.loginURLAttr';
2020
const PERUN_TEST_SP_ATTR_NAME = 'listOfSps.isTestSpAttr';
2121
const PERUN_SHOW_ON_SERVICE_LIST_ATTR_NAME = 'listOfSps.showOnServiceListAttr';
22+
const PERUN_SHOW_PROTOCOL = 'listOfSps.showProtocol';
2223
const PERUN_SAML2_ENTITY_ID_ATTR_NAME = 'listOfSps.SAML2EntityIdAttr';
2324
const PERUN_OIDC_CLIENT_ID_ATTR_NAME = 'listOfSps.OIDCClientIdAttr';
2425

@@ -72,6 +73,8 @@
7273
$perunShowOnServiceListAttr
7374
= $conf->getString(PERUN_SHOW_ON_SERVICE_LIST_ATTR_NAME, null);
7475

76+
$showProtocol = $conf->getBoolean(PERUN_SHOW_PROTOCOL, true);
77+
7578
$rpcAdapter = new AdapterRpc();
7679
$attributeDefinition = [];
7780
$attributeDefinition[$perunProxyIdentifierAttr] = $proxyIdentifier;
@@ -192,6 +195,7 @@
192195
$t->data['statistics'] = $statistics;
193196
$t->data['attributesToShow'] = $attributesToShow;
194197
$t->data['multilingualAttributes'] = $multilingualAttributes;
198+
$t->data['showProtocol'] = $showProtocol;
195199
$t->data['isNameMultilingual'] = in_array($perunServiceNameAttr, $multilingualAttributes, true);
196200
$t->data['samlServices'] = $samlServices;
197201
$t->data['oidcServices'] = $oidcServices;

0 commit comments

Comments
 (0)