Example #1
0
 public function handleRemoveAdmin($id)
 {
     try {
         $this->userRepo->removeSystemAdmin($id);
         $this->flashMessage('Admin odebrán', 'success');
     } catch (Nette\InvalidStateException $ex) {
         $this->flashMessage('V aplikaci musí být alespoň jeden administrátor', 'error');
     }
     $this->redrawControl();
 }
Example #2
0
 public function beforeRender()
 {
     parent::beforeRender();
     $nullUsers = $this->userRepository->findBy(array('uuid' => NULL, 'NOT mcname' => NULL));
     try {
         foreach ($nullUsers as $user) {
             $identity = $this->uuidModel->getUuid($user->mcname, TRUE);
             $this->userRepository->setUUID($user->id, $identity['uuid']);
             $this->userRepository->setMcNick($user->id, $identity['name']);
         }
     } catch (RuntimeException $exc) {
         //echo nothing critical
     }
 }
Example #3
0
 public function renderAdmin($id)
 {
     if ($this->user->isInRole('admin')) {
         $this['passwordForm']['changedId']->setValue($id);
         $mcname = $this->userRepo->findById($id)->fetch()->mcname;
         $this['mcNick']['mcname']->setValue($mcname);
         $this['mcNick']['userId']->setValue($id);
         $this->template->userData = $this->userRepo->findById($id)->fetch();
     }
 }