public function newUserFormSubmitted(Form $form) { $values = $form->getValues(); $user = $this->getUser()->isLoggedIn() ? $this->getUser()->getIdentity()->getRoles() : NULL; if (!empty($user['admin'])) { $this->userRepository->createUser($values->username, $values->password, $values->isAdmin); $this->flashMessage('Uživatel byl vytvořen.', 'success'); $this->redirect('User:'******'Unauthorized access to newUserForm!'); } }