Esempio n. 1
0
 public function set($key, $value)
 {
     if ($this->key($key) == 'password') {
         $value = $this->generate_hash($value);
     }
     // Set
     return parent::set($key, $value);
 }
 public function get($key = '')
 {
     // Path: Always remove trailing slash on NFS path
     if ($this->key($key) == 'path') {
         return rtrim(parent::get($key), '/');
     }
     // FOGController get()
     return parent::get($key);
 }
Esempio n. 3
0
 public function destroy($field = 'id')
 {
     $Host = new Host($this->get('hostID'));
     $SnapinJobs = $this->getClass('SnapinJobManager')->find(array('hostID' => $Host->get('id')));
     if ($SnapinJobs) {
         foreach ($SnapinJobs as $SnapinJob) {
             $SnapinTasks[] = $this->getClass('SnapinTaskManager')->find(array('jobID' => $SnapinJob->get('id'), 'stateID' => array(0, 1)));
         }
     }
     // cancel's all the snapin tasks for that host.
     if ($SnapinTasks) {
         foreach ($SnapinTasks as $ST) {
             foreach ($ST as $SnapinTask) {
                 $SnapinTask->set('stateID', -1)->save();
             }
         }
     }
     // FOGController destroy
     return parent::destroy($field);
 }
Esempio n. 4
0
 public function destroy($field = 'id')
 {
     $this->getClass('ModuleAssociationManager')->find(array('moduleID' => $this->get('id')));
     return parent::destroy($field);
 }
 /** @function __construct() the class constructor
  * @param $data the data to pass to the parent constructor
  * @return sets the ip field to that of the remote server
  */
 public function __construct($data = '')
 {
     parent::__construct($data);
     return $this->set('ip', $_SERVER['REMOTE_ADDR']);
 }
Esempio n. 6
0
 public function destroy($field = 'id')
 {
     // Complete active tasks
     if ($this->get('task') && $this->get('task')->isValid()) {
         $this->get('task')->set('stateID', 5)->save();
     }
     // Remove Snapinjob Associations
     if ($this->get('snapinjob') && $this->get('snapinjob')->isValid()) {
         $this->get('snapinjob')->set('stateID', 5)->save();
     }
     // Remove Group associations
     $this->getClass('GroupAssociationManager')->destroy(array('hostID' => $this->get('id')));
     // Remove Module associations
     $this->getClass('ModuleAssociationManager')->destroy(array('hostID' => $this->get('id')));
     // Remove Snapin associations
     $this->getClass('SnapinAssociationManager')->destroy(array('hostID' => $this->get('id')));
     // Remove Printer associations
     $this->getClass('PrinterAssociationManager')->destroy(array('hostID' => $this->get('id')));
     // Remove Additional MAC Associations
     $this->getClass('MACAddressAssociationManager')->destroy(array('hostID' => $this->get('id')));
     // Remove Stored Fingerprints
     $this->getClass('FingerprintAssociationManager')->destroy(array('id' => $this->get('id')));
     // Remove Queued Items
     $this->getClass('QueueManager')->destroy(array('hostID' => $this->get('id')));
     // Update inventory to know when it was deleted
     if ($this->get('inventory')) {
         $this->get('inventory')->set('deleteDate', $this->nice_date()->format('Y-m-d H:i:s'))->save();
     }
     $this->HookManager->processEvent('DESTROY_HOST', array('Host' => &$this));
     // Return
     return parent::destroy($field);
 }
 public function destroy($field = 'id')
 {
     return parent::destroy($field);
 }
Esempio n. 8
0
 public function destroy($field = 'id')
 {
     // Remove all associations
     $this->getClass('SnapinAssociationManager')->destroy(array('snapinID' => $this->get('id')));
     foreach ($this->getClass('SnapinTaskManager')->find(array('snapinID' => $this->get('id'))) as $SnapJob) {
         $this->getClass('SnapinJobManager')->destroy(array('jobID' => $SnapJob->get('jobID')));
         $SnapJob->destroy();
     }
     $this->getClass('SnapinGroupAssociationManager')->destroy(array('snapinID' => $this->get('id')));
     // Return
     return parent::destroy($field);
 }
Esempio n. 9
0
 public function destroy($field = 'id')
 {
     // Remove All Host Associations
     $this->getClass('GroupAssociationManager')->destroy(array('groupID' => $this->get('id')));
     // Return
     return parent::destroy($field);
 }
Esempio n. 10
0
 public function load($field = 'id')
 {
     parent::load($field);
     foreach (get_class_methods($this) as $method) {
         if (strlen($method) > 5 && strpos($method, 'load')) {
             $this->{$method}();
         }
     }
 }
Esempio n. 11
0
 public function destroy($field = 'id')
 {
     $this->getClass('LDAPManager')->find(array('LDAPID' => $this->get('id')));
     return parent::destroy($field);
 }
Esempio n. 12
0
 public function destroy($field = 'id')
 {
     // Remove all Host associations
     $this->getClass('PrinterAssociationManager')->destroy(array('printerID' => $this->get('id')));
     // Return
     return parent::destroy($field);
 }