public function serialize() {
        $r=['user'=>$this->user
            ,'name'=>$this->fullName
            ,'uid'=>$this->uid
            ,'group'=>$this->group
            ,'role'=>$this->role];
        /* optional fields */
        if ($this->email!==null) $r['email']=$this->email;
        if ($this->iduser!==null) $r['iduser']=$this->iduser;

        $r['extrafields']=$this->extraFields;

        return $r;
    }