Ejemplo n.º 1
0
 /** 
  * Delete the provided item from the database, only if it's not a permanent user
  *
  */
 public function ___delete(Saveable $item)
 {
     if (!$item instanceof User || $item instanceof NullUser) {
         throw new WireException("Item passed Users::delete is not a User");
     }
     if ($item->isPermanent()) {
         throw new WireException("User ID {$item->id} is permanent and may not be deleted");
     }
     return parent::___delete($item);
 }
Ejemplo n.º 2
0
 /**
  * Per WireSaveableItemsLookup interface, delete the given role but only if it's not a permament one
  *
  */
 public function ___delete(Saveable $item)
 {
     if (!$item instanceof Role) {
         throw new WireException("Roles::delete requires Role instance");
     }
     if ($item->isPermanent()) {
         throw new WireException("Role {$item->name} is required by the system and may not be deleted");
     }
     $this->fuel('pagesRoles')->deletePagesFromRole($item);
     $this->fuel('db')->query("DELETE from users_roles WHERE roles_id=" . (int) $item->id);
     return parent::___delete($item);
 }