/** * Loads Restriction object by id * * @param int id * @return RM_Restriction_Object **/ public function loadRestrictionById($id) { if (!isNull($object = $this->_mapper->storage('restriction')->loadObjectById($id))) { $this->_mapper->access($object, 'READ'); } return $object; }
/** * Deletes report object * * @return void **/ public function delete() { // проверим права доступа на запись отчета $this->_mapper->access($this, 'DELETE'); $result = parent::delete(); if ($result) { $this->_mapper->_deleteCollection('hide', $this); $this->_mapper->_deleteCollection('group', $this); // delete related objects $this->removeAllDiagrams(); $this->removeAllValues(); $this->removeAllRestrictions(); // delete related tables $table_name = $this->getTableName(); M('Db')->setCurrentConnection('storage'); foreach (M('Db')->query('SHOW TABLES LIKE ?', $table_name . '%') as $row) { M('Db')->exec('DROP TABLE IF EXISTS ' . array_pop($row)); } M('Db')->setCurrentConnection('default'); // TODO: // delete permissions } return $result; }