From 7c4d43c095b763a8e202586bf8f597fb289b852d Mon Sep 17 00:00:00 2001 From: Guy Halse <guy@tenet.ac.za> Date: Mon, 28 May 2018 14:33:46 +0200 Subject: [PATCH] Consent: Rename noconsentattributes option Per suggestion from @jaimeperez, rename the undocumented noconsentattributes option to be more consistent with other things and with what has been done in the ConsentAdmin module. The old version remains supported for backwards compatibility but issues a warning. --- modules/consent/docs/consent.md | 2 +- modules/consent/lib/Auth/Process/Consent.php | 10 +++++++++- .../config-templates/module_consentAdmin.php | 2 +- modules/consentAdmin/docs/consentAdmin.md | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/consent/docs/consent.md b/modules/consent/docs/consent.md index d057eb1b4..33e15a38e 100644 --- a/modules/consent/docs/consent.md +++ b/modules/consent/docs/consent.md @@ -160,7 +160,7 @@ The following options can be used when configuring the Consent module: the attributes that should have their value hidden. Default behaviour is that all attribute values are shown. -`noconsentattributes` +`attributes.exclude` : Allows certain attributes to be excluded from the attribute hash when `includeValues` is `true` (and as a side effect, to be hidden from display as `hiddenAttributes` does). Set to an array of the attributes that should diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php index 0647ac84f..203666e65 100644 --- a/modules/consent/lib/Auth/Process/Consent.php +++ b/modules/consent/lib/Auth/Process/Consent.php @@ -116,7 +116,15 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt $this->_hiddenAttributes = $config['hiddenAttributes']; } - if (array_key_exists('noconsentattributes', $config)) { + if (array_key_exists('attributes.exclude', $config)) { + if (!is_array($config['attributes.exclude'])) { + throw new SimpleSAML_Error_Exception( + 'Consent: attributes.exclude must be an array. '. + var_export($config['attributes.exclude'], true).' given.' + ); + } + } elseif (array_key_exists('noconsentattributes', $config)) { + SimpleSAML\Logger::warning("The 'noconsentattributes' option has been deprecated in favour of 'attributes.exclude'."); if (!is_array($config['noconsentattributes'])) { throw new SimpleSAML_Error_Exception( 'Consent: noconsentattributes must be an array. '. diff --git a/modules/consentAdmin/config-templates/module_consentAdmin.php b/modules/consentAdmin/config-templates/module_consentAdmin.php index 627634ba1..02fdf8d42 100644 --- a/modules/consentAdmin/config-templates/module_consentAdmin.php +++ b/modules/consentAdmin/config-templates/module_consentAdmin.php @@ -19,7 +19,7 @@ $config = array( // Hash attributes including values or not 'attributes.hash' => true, - // If you set noconsentattributes in the consent module, this must match + // If you set attributes.exclude in the consent module, this must match // 'attributes.exclude' => array(), // Where to direct the user after logout diff --git a/modules/consentAdmin/docs/consentAdmin.md b/modules/consentAdmin/docs/consentAdmin.md index 6a420353c..1dc342e7f 100644 --- a/modules/consentAdmin/docs/consentAdmin.md +++ b/modules/consentAdmin/docs/consentAdmin.md @@ -44,7 +44,7 @@ Setting optional parameters In order to make the consentAdmin module work together with the consent module correctly, you need to set the configuration 'attributes.hash' according to the value of 'includeValues' configuration in the consent -module. Likewise, if you've used the 'noconsentattributes' configuration +module. Likewise, if you've used the 'attributes.exclude' configuration option in the consent module, you should also set the 'attributes.exclude' configuration option here to match. -- GitLab