Ejemplo n.º 1
0
 /**
  * Save the provided User item to the database
  *
  */
 public function ___save(Saveable $item)
 {
     if (!$item instanceof User || $item instanceof NullUser) {
         throw new WireException("Item passed Users::save is not a User");
     }
     if ($item->isChanged('pass') || !$item->id) {
         $item->set('salt', md5(mt_rand() . microtime()));
         $item->set('pass', $this->passHash($item->get('pass'), $item));
     }
     // The owner role is for runtime use only, so users may not be saved with the User role
     if ($item->hasRole(Role::ownerRoleID)) {
         $item->removeRole(Role::ownerRoleID);
     }
     return parent::___save($item);
 }