示例#1
0
 public function afterAddObject($class)
 {
     switch ($class) {
         case Schemas\ShadowAccount::class:
             $encoder = new CryptEncoder();
             foreach ($this->getAttributes()->get('userpassword') as $password) {
                 $password = $encoder->parsePassword($password);
                 $this->password = $password;
                 break;
             }
             break;
         case Schemas\LenticularUser::class:
             $this->roles = $this->getObject(Schemas\LenticularUser::class)->getAuthRoles();
             $this->enable = $this->getRoles() > 0;
             if ($this->getObject(Schemas\LenticularUser::class)->getUid() === null) {
                 $this->getObject(Schemas\LenticularUser::class)->setUid($this->username);
             } else {
                 $this->username = $this->getObject(Schemas\LenticularUser::class)->getUid();
             }
             break;
         case Schemas\InetOrgPerson::class:
             $object = $this->getObject(Schemas\InetOrgPerson::class);
             if ($object->getSn() == null) {
                 $object->setSn($this->username);
             }
             if ($object->getCn() == null) {
                 $object->setCn($this->username);
             }
     }
 }
 public function afterAddObject($class)
 {
     if ($class === Schemas\ShadowAccount::class) {
         $encoder = new CryptEncoder();
         $this->passwords = [];
         foreach ($this->getObject(Schemas\ShadowAccount::class)->getUserPasswords() as $password) {
             $password = $encoder->parsePassword($password);
             $this->passwords[$password->getId()] = $password;
         }
     }
 }