Commit a456f9db authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch '6015-add-support-for-supann-cms-carte-multi-service' into '1.4-dev'

Resolve "Add support for SupAnn CMS (Carte Multi Service)"

See merge request fusiondirectory/fd-plugins!706
parents fbfb4fe3 c69d81eb
......@@ -30,32 +30,32 @@ class SupannCMSAffectationAttribute extends SupannCompositeAttribute
$attributes = [
new SelectAttribute(
_('Type'), _('supannCMSType - Card type'),
'supannCMSType_type', TRUE,
'supannCMSType_type_'.$ldapName, TRUE,
$types, '', $typeLabels
),
new SelectAttribute(
_('Format'), _('Card format'),
'none_format', TRUE,
'none_format_'.$ldapName, TRUE,
$formats, '', $formatLabels
),
new StringAttribute(
_('Id'), _('Card id'),
'none_id', TRUE
'none_id_'.$ldapName, TRUE
),
new BooleanAttribute(
_('Valid'), _('Card validity'),
'none_valide', TRUE,
'none_valide_'.$ldapName, TRUE,
TRUE, '',
'vrai', 'faux'
),
new SelectAttribute(
_('Source'), _('Card managing system and establishment'),
'supannCMSSource_source', FALSE,
'supannCMSSource_source_'.$ldapName, FALSE,
$config->get_cfg_value('supannCMSSources', [])
),
new GeneralizedTimeDateAttribute(
_('End date'), _('End of validity date, if any'),
'supannCMSDateFin_datefin', FALSE,
'supannCMSDateFin_datefin_'.$ldapName, FALSE,
''
),
];
......@@ -70,19 +70,19 @@ class SupannCMSAffectationAttribute extends SupannCompositeAttribute
function supannGetValues (&$values)
{
foreach ($this->attributes as &$attribute) {
$shortname = preg_replace('/^([^_]+)_.*$/', '\\1', $attribute->getLdapName());
if ($shortname == 'none') {
list($attrname, ) = explode('_', $attribute->getLdapName());
if ($attrname == 'none') {
continue;
}
$value = $attribute->getValue();
if (!isset($values[$shortname])) {
$values[$shortname] = [];
if (!isset($values[$attrname])) {
$values[$attrname] = [];
}
if ($value == '') {
continue;
}
if ($this->isValid()) {
$values[$shortname][$value] = $value;
$values[$attrname][$value] = $value;
}
}
unset($attribute);
......
......@@ -29,32 +29,32 @@ class SupannCMSAppAffectationAttribute extends SupannCompositeAttribute
$attributes = [
new SelectAttribute(
_('Type'), _('supannCMSType - Card type'),
'supannCMSType_type', TRUE,
'supannCMSType_type_'.$ldapName, TRUE,
$types, '', $typeLabels
),
new SelectAttribute(
_('Source'), _('Card managing system and establishment'),
'supannCMSSource_source', TRUE,
'supannCMSSource_source_'.$ldapName, TRUE,
$config->get_cfg_value('supannCMSSources', [])
),
new SelectAttribute(
_('Domain'), _('Application domain'),
'none_domaine', TRUE,
'none_domaine_'.$ldapName, TRUE,
array_column($this->getConfigAppDomains(), 1)
),
new StringAttribute(
_('Id'), _('Application id'),
'none_id', TRUE
'none_id_'.$ldapName, TRUE
),
new BooleanAttribute(
_('Valid'), _('Application validity'),
'none_valide', TRUE,
'none_valide_'.$ldapName, TRUE,
TRUE, '',
'vrai', 'faux'
),
new GeneralizedTimeDateAttribute(
_('End date'), _('End of validity date, if any'),
'supannCMSDateFin_datefin', FALSE,
'supannCMSDateFin_datefin_'.$ldapName, FALSE,
''
),
];
......@@ -80,19 +80,19 @@ class SupannCMSAppAffectationAttribute extends SupannCompositeAttribute
function supannGetValues (&$values)
{
foreach ($this->attributes as &$attribute) {
$shortname = preg_replace('/^([^_]+)_.*$/', '\\1', $attribute->getLdapName());
if ($shortname == 'none') {
list($attrname, ) = explode('_', $attribute->getLdapName());
if ($attrname == 'none') {
continue;
}
$value = $attribute->getValue();
if (!isset($values[$shortname])) {
$values[$shortname] = [];
if (!isset($values[$attrname])) {
$values[$attrname] = [];
}
if ($value == '') {
continue;
}
if ($this->isValid()) {
$values[$shortname][$value] = $value;
$values[$attrname][$value] = $value;
}
}
unset($attribute);
......
......@@ -32,11 +32,11 @@ class SupannCompositeAttribute extends CompositeAttribute
$values = [];
$m = [];
foreach ($this->attributes as &$attribute) {
$shortname = preg_replace('/^[^_]+_/', '', $attribute->getLdapName());
list(, $shortname) = explode('_', $attribute->getLdapName());
if (preg_match("/\\[$shortname=([^\\]]+)\\]/", $value, $m)) {
$values[] = $m[1];
} else {
$values[] = "";
$values[] = '';
}
}
unset($attribute);
......@@ -50,7 +50,7 @@ class SupannCompositeAttribute extends CompositeAttribute
$i = 0;
foreach ($this->attributes as &$attribute) {
if ($values[$i] != '') {
$shortname = preg_replace('/^[^_]+_/', '', $attribute->getLdapName());
list(, $shortname) = explode('_', $attribute->getLdapName());
$value .= "[$shortname=".$values[$i]."]";
}
$i++;
......@@ -62,15 +62,15 @@ class SupannCompositeAttribute extends CompositeAttribute
function supannGetValues (&$values)
{
foreach ($this->attributes as &$attribute) {
$shortname = preg_replace('/^([^_]+)_.*$/', '\\1', $attribute->getLdapName());
list($attrname, ) = explode('_', $attribute->getLdapName());
$value = $attribute->getValue();
if (!isset($values[$shortname])) {
$values[$shortname] = [];
if (!isset($values[$attrname])) {
$values[$attrname] = [];
}
if ($value == "") {
if ($value == '') {
continue;
}
$values[$shortname][$value] = $value;
$values[$attrname][$value] = $value;
}
unset($attribute);
}
......
......@@ -33,7 +33,7 @@ class supannCMS extends simplePlugin
'plSelfModify' => TRUE,
'plPriority' => 16,
'plObjectClass' => ['supannCMS'],
'plObjectType' => ['user'],
'plObjectType' => ['user','group','ogroup-user','role','etablissement','entite'],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
......
Markdown is supported
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