Ajoute un vérification de cohérence sur les attributs eduPersonAffiliation et eduPersonPrimaryAffiliation

This commit is contained in:
Benjamin Dauvergne 2015-03-28 12:10:24 +01:00
parent f29a0acc7d
commit e83c63e0de
1 changed files with 33 additions and 0 deletions

View File

@ -22,6 +22,27 @@
require('referentiels.php');
$checked = false;
function check_edupersonaffiliation($object) {
global $checked;
$values = $object->getValue('eduPersonAffiliation');
if (!$checked && in_array('affiliate', $values) && in_array('member', $values)) {
$checked = true;
return false;
}
return true;
}
function check_edupersonprimaryaffiliation($object) {
$primary = $object->getValue('eduPersonPrimaryAffiliation');
$affiliations = $object->getValue('eduPersonAffiliation');
$intersection = array_intersect($primary, $affiliations);
if (! $intersection) {
return false;
}
return true;
}
$GLOBALS['LSobjects']['LSsupannPerson'] = array (
'objectclass' => array(
'inetOrgPerson',
@ -745,6 +766,12 @@ $GLOBALS['LSobjects']['LSsupannPerson'] = array (
'html_options' => array (
'possible_values' => $liste_affiliations
),
'validation' => array(
array(
'msg' => 'Les valeurs affiliate et member sont incompatibles',
'function' => 'check_edupersonaffiliation',
),
),
'multiple' => 1,
'rights' => array(
'self' => 'r',
@ -766,6 +793,12 @@ $GLOBALS['LSobjects']['LSsupannPerson'] = array (
'html_options' => array (
'possible_values' => $liste_affiliations
),
'validation' => array(
array(
'msg' => 'Le profil principal doit faire faire partie des profils',
'function' => 'check_edupersonprimaryaffiliation',
),
),
'multiple' => 0,
'rights' => array(
'self' => 'r',