Пример #1
0
 public function beforeDelete()
 {
     if (!UserAccess::get()->isCategoryAdmin($this->category_id, $this->category->section_id)) {
         Messages::get()->error("You can't delete this category!");
         return false;
     }
     return parent::beforeDelete();
 }
Пример #2
0
 public function beforeDelete()
 {
     App::get()->sql()->table('users2groups')->where('group_id = :group')->setParam(':group', $this->id)->delete();
     //delete connections from this group to users
     return parent::beforeDelete();
 }
Пример #3
0
 public function beforeDelete()
 {
     if (is_a(App::get(), '\\mpf\\WebApp')) {
         if (!UserAccess::get()->isSectionAdmin($this->section_id)) {
             Messages::get()->error("You don't have access to delete this user group!");
             return false;
         }
     }
     return parent::beforeDelete();
 }
Пример #4
0
 /**
  * Before deleting user delete every other tables connected to it.
  * @return bool|void
  */
 public function beforeDelete()
 {
     App::get()->sql()->table('users2groups')->where("user_id = :id")->setParam(':id', $this->id)->delete();
     UserHistory::deleteAllByAttributes(['user_id' => $this->id]);
     UserConfig::deleteAllByAttributes(['user_id' => $this->id]);
     return parent::beforeDelete();
 }
Пример #5
0
 public function beforeDelete()
 {
     User::updateAll(['title_id' => 0], "title_id = :title", array(':title' => $this->id));
     // update user titles to 0 where this id is used.
     return parent::beforeDelete();
 }