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

Commit 5be416f

Browse files
Merge pull request #189 from BaranekD/addInstitution_whitelisting_disabled
feat: Turn off addInstitution when whitelisting is disabled
2 parents a90dd37 + 91990b5 commit 5be416f

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

config-templates/module_perun.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
* specify if disco module should filter out IdPs which are not whitelisted neither committed to CoCo or RaS.
180180
* default is false.
181181
*/
182-
'disable_white_listing' => false,
182+
'disable_whitelisting' => false,
183183
/**
184184
* Specify translate module
185185
*/
@@ -223,7 +223,12 @@
223223
'boxed' => true,
224224
// block of IDPs
225225
'idp_blocks_config' => [
226-
[
226+
'preferred_idps' => [
227+
'type' => 'tagged',
228+
'name' => 'preferred_idps',
229+
'tags' => ['preferred'],
230+
],
231+
'edugain' => [
227232
// type has to be 'inlinesearch' for displaying eduGAIN entries or 'tagged' for custom IDPs
228233
'type' => 'inlinesearch',
229234
// name that will be used in some classes and translation keys
@@ -246,7 +251,7 @@
246251
],
247252
*/
248253
],
249-
[
254+
'social_idps' => [
250255
'type' => 'tagged',
251256
'name' => 'social_idps',
252257
'text_enabled' => false,

dictionaries/disco.definition.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
"en": "Still can't find your institution? Contact us at",
6868
"cs": "Stále nemůžete nalézt vaši instituci? Kontaktujte nás na"
6969
},
70+
"cannot_find_institution_disabled_whitelisting": {
71+
"en": "Cannot find your institution? Contact us at",
72+
"cs": "Nemúžete nalézt vaši organizaci? Kontaktujte nás na"
73+
},
7074
"js_not_loaded_message": {
7175
"en": "Your browser does not support the required functionality to display this page. Please use a different browser and try again. We apologize for the caused difficulties.",
7276
"cs": "Váš prohlížeč nepodporuje funkcionalitu potřebnou pro správné zobrazení této stránky. Zkuste, prosím, použít jiný prohlížeč. Omlouváme se za vzniklé problémy."

lib/Disco.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ public static function showWarning(DiscoTemplate $t, WarningConfiguration $warni
473473
public static function showInlineSearch(
474474
DiscoTemplate $t,
475475
Configuration $blockConfig,
476+
bool $disableWhitelisting,
476477
Configuration $addInstitution = null
477478
): string {
478479
$result = '';
@@ -518,7 +519,11 @@ public static function showInlineSearch(
518519
$result .= ' </div>' . PHP_EOL;
519520
# NO ENTRIES BLOCK
520521
$result .= ' <div id="no-entries" class="no-idp-found alert alert-info entries-warning-block">' . PHP_EOL;
521-
if ($isAddInstitutionApp && $addInstitutionEmail !== null) {
522+
if ($disableWhitelisting && $addInstitutionEmail !== null) {
523+
$result .= ' ' . $t->t('{perun:disco:cannot_find_institution_disabled_whitelisting}') .
524+
' <a href="mailto:' . $addInstitutionEmail . '?subject=Request%20for%20adding%20new%20IdP">' .
525+
$addInstitutionEmail . '</a>' . PHP_EOL;
526+
} elseif ($isAddInstitutionApp && $addInstitutionEmail !== null) {
522527
$result .= ' ' . $t->t('{perun:disco:add_institution_no_entries_contact_us}') .
523528
' <a href="mailto:' . $addInstitutionEmail . '?subject=Request%20for%20adding%20new%20IdP">' .
524529
$addInstitutionEmail . '</a>' . PHP_EOL;

themes/perun/perun/disco-tpl.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@
8282
$type = $blockConfig->getString(Disco::IDP_BLOCK_TYPE);
8383
echo '<div class="row login-option-category">' . PHP_EOL;
8484
if ($type === Disco::IDP_BLOCK_TYPE_INLINESEARCH) {
85-
echo Disco::showInlineSearch($this, $blockConfig, $addInstitutionConfig) . PHP_EOL;
85+
echo Disco::showInlineSearch(
86+
$this,
87+
$blockConfig,
88+
$wayfConfig->getBoolean(Disco::DISABLE_WHITELISTING, false),
89+
$addInstitutionConfig
90+
) . PHP_EOL;
8691
}
8792
echo '</div>' . PHP_EOL;
8893
}
@@ -120,7 +125,12 @@
120125
$type = $blockConfig->getString(Disco::IDP_BLOCK_TYPE);
121126
echo '<div class="row login-option-category">' . PHP_EOL;
122127
if (strtolower($type) === Disco::IDP_BLOCK_TYPE_INLINESEARCH) {
123-
echo Disco::showInlineSearch($this, $blockConfig, $addInstitutionConfig) . PHP_EOL;
128+
echo Disco::showInlineSearch(
129+
$this,
130+
$blockConfig,
131+
$wayfConfig->getBoolean(Disco::DISABLE_WHITELISTING, false),
132+
$addInstitutionConfig
133+
) . PHP_EOL;
124134
} elseif (strtolower($type) === Disco::IDP_BLOCK_TYPE_TAGGED) {
125135
echo Disco::showTaggedIdPs($this, $blockConfig) . PHP_EOL;
126136
}

0 commit comments

Comments
 (0)