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(); }
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 } }
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(); } }