Verified Commit 2aea84b1 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(supann) Add support for supannConsentement

Possible tag and values need to be specified in configuration.

issue #6025
Showing with 125 additions and 3 deletions
+125 -3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2013-2019 FusionDirectory Copyright (C) 2013-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -240,6 +240,70 @@ class supannConfig extends simplePlugin ...@@ -240,6 +240,70 @@ class supannConfig extends simplePlugin
), ),
] ]
], ],
'consent' => [
'name' => _('Consent'),
'class' => ['fullwidth'],
'attrs' => [
new OrderedArrayAttribute(
new CharSeparatedCompositeAttribute(
_('Objects which may be used as tag in supannConsentement'),
'fdSupannConsentementObjects',
[
new StringAttribute(
_('Object'), _('Consent object'),
'fdSupannConsentementObjects_object', TRUE
),
new StringAttribute(
_('Label'), _('Label shown for this object'),
'fdSupannConsentementObjects_label', TRUE
),
],
';',
'',
_('Consent objects')
),
FALSE,
[
'JPEGPHOTO;Picture',
'SUPANNMAILPERSO;Personal email',
'MAIL;Email',
'MOBILE;Mobile',
],
TRUE
),
new OrderedArrayAttribute(
new CharSeparatedCompositeAttribute(
_('Types which may be used as value in supannConsentement'),
'fdSupannConsentementTypes',
[
new StringAttribute(
_('Type'), _('Consent type'),
'fdSupannConsentementTypes_type', TRUE
),
new StringAttribute(
_('Label'), _('Label shown for this type'),
'fdSupannConsentementTypes_label', TRUE
),
],
';',
'',
_('Consent types')
),
FALSE,
[
'PUBLIC;Public',
'AUTH;Authenticated',
'PR;Resource people',
'APPRENANTS;APPRENANTS',
'INTERNE;Intern',
'FER;FER',
'EDUGAIN;EduGAIN',
'CGU;CGU',
],
TRUE
),
]
]
]; ];
} }
......
...@@ -58,6 +58,18 @@ attributetype ( 1.3.6.1.4.1.38414.17.1.9 NAME 'fdSupannCMSTypes' ...@@ -58,6 +58,18 @@ attributetype ( 1.3.6.1.4.1.38414.17.1.9 NAME 'fdSupannCMSTypes'
SUBSTR caseIgnoreSubstringsMatch SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.17.1.10 NAME 'fdSupannConsentementObjects'
DESC 'FusionDirectory - SupAnn possible tags for supannConsentement - format object;Label'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.17.1.11 NAME 'fdSupannConsentementTypes'
DESC 'FusionDirectory - SupAnn possible values for supannConsentement - format type;Label'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
# Object Class # Object Class
objectclass ( 1.3.6.1.4.1.38414.17.2.1 NAME 'fdSupannPluginConf' objectclass ( 1.3.6.1.4.1.38414.17.2.1 NAME 'fdSupannPluginConf'
DESC 'FusionDirectory SupAnn plugin configuration' DESC 'FusionDirectory SupAnn plugin configuration'
...@@ -66,5 +78,6 @@ objectclass ( 1.3.6.1.4.1.38414.17.2.1 NAME 'fdSupannPluginConf' ...@@ -66,5 +78,6 @@ objectclass ( 1.3.6.1.4.1.38414.17.2.1 NAME 'fdSupannPluginConf'
MAY ( MAY (
fdSupannStructuresRDN $ fdSupannPasswordRecovery $ fdSupannStructuresRDN $ fdSupannPasswordRecovery $
fdSupannRessourceSubStates $ fdSupannRessourceSubStatesLabels $ fdSupannRessourceLabels $ fdSupannRessourceSubStates $ fdSupannRessourceSubStatesLabels $ fdSupannRessourceLabels $
fdSupannCMSTypes $ fdSupannCMSSources $ fdSupannCMSFormats $ fdSupannCMSAppDomains fdSupannCMSTypes $ fdSupannCMSSources $ fdSupannCMSFormats $ fdSupannCMSAppDomains $
fdSupannConsentementObjects $ fdSupannConsentementTypes
) ) ) )
...@@ -24,7 +24,7 @@ class SupannPrefixedSelectAttribute extends CompositeAttribute ...@@ -24,7 +24,7 @@ class SupannPrefixedSelectAttribute extends CompositeAttribute
{ {
protected $prefixedChoices; protected $prefixedChoices;
function __construct (string $label, string $description, string $ldapName, bool $required, string $filename, string $acl = '') function __construct (string $label, string $description, string $ldapName, bool $required, string $filename = '', string $acl = '')
{ {
$attributes = [ $attributes = [
new SelectAttribute('', '', $ldapName.'_prefix', $required), new SelectAttribute('', '', $ldapName.'_prefix', $required),
......
...@@ -316,6 +316,31 @@ class supannAccount extends simplePlugin ...@@ -316,6 +316,31 @@ class supannAccount extends simplePlugin
) )
] ]
], ],
'consentement' => [
'name' => _('Consent'),
'class' => ['fullwidth'],
'attrs' => [
new OrderedArrayAttribute(
new CompositeAttribute(
_('supannConsentement - user consent on the usage of his information'),
'supannConsentement',
[
new SelectAttribute('', '', 'supannConsentement_prefix', TRUE),
new SelectAttribute('', '', 'supannConsentement_content', TRUE)
],
'/^{(.*)}(.*)$/',
'{%s}%s',
'',
_('Consent')
),
// no order
FALSE,
[],
// edit button
TRUE
)
]
],
]; ];
} }
...@@ -377,6 +402,8 @@ class supannAccount extends simplePlugin ...@@ -377,6 +402,8 @@ class supannAccount extends simplePlugin
protected function supannInit () protected function supannInit ()
{ {
global $config;
list ($codes, $labels) = supann::get_choices_for('affiliation'); list ($codes, $labels) = supann::get_choices_for('affiliation');
$this->attributesAccess['eduPersonAffiliation']->attribute->setChoices($codes, $labels); $this->attributesAccess['eduPersonAffiliation']->attribute->setChoices($codes, $labels);
...@@ -395,6 +422,24 @@ class supannAccount extends simplePlugin ...@@ -395,6 +422,24 @@ class supannAccount extends simplePlugin
]); ]);
$this->attributesAccess['supannEtuInscription']->setLinearRendering(FALSE); $this->attributesAccess['supannEtuInscription']->setLinearRendering(FALSE);
$objects = [];
$objectLabels = [];
foreach ($config->get_cfg_value('SupannConsentementObjects', []) as $supannConsentementObject) {
list($object, $label) = explode(';', $supannConsentementObject);
$objects[] = $object;
$objectLabels[] = $label;
}
$this->attributesAccess['supannConsentement']->attribute->attributes[0]->setChoices($objects, $objectLabels);
$types = [];
$typeLabels = [];
foreach ($config->get_cfg_value('SupannConsentementTypes', []) as $supannConsentementType) {
list($type, $label) = explode(';', $supannConsentementType);
$types[] = $type;
$typeLabels[] = $label;
}
$this->attributesAccess['supannConsentement']->attribute->attributes[1]->setChoices($types, $typeLabels);
$this->updateFieldsChoicesAndValues(); $this->updateFieldsChoicesAndValues();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment