Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

AM Recover UID and schacHomeOrganization from ePPN

Remold edited this page Jul 31, 2015 · 2 revisions
# This attribute manipulation reconstructs a uid and schacHomeOrg
# from an EPPN
 
$attr_eppn = "urn:mace:dir:attribute-def:eduPersonPrincipalName";
$attr_uid  = "urn:mace:dir:attribute-def:uid";
$attr_sho  = "urn:mace:terena.org:attribute-def:schacHomeOrganization";
 
if (    isset($attributes)
    and ($attributes !== FALSE)
    and !empty($attributes[$attr_eppn][0])
    and ( empty($attributes[$attr_uid][0]) or empty($attributes[$attr_sho][0]) )
   )
{
    $fields = explode("@", $attributes[$attr_eppn][0], 2 );
    if ( count($fields)==2 and !empty($fields[0]) and !empty($fields[1]) )
    {
        $attributes[$attr_uid] = array( $fields[0] );
        $attributes[$attr_sho] = array( $fields[1] );
    }
}