Пример #1
0
 public function onSuccessImageRemoval($imageName)
 {
     $rearSlashPosition = mb_strpos($imageName, '/');
     $imageID = mb_substr($imageName, 0, $rearSlashPosition);
     $imageOriginalName = mb_substr($imageName, $rearSlashPosition + 1);
     $this->appEventLogger->saveLog(sprintf('User [%s#%s] <b>has REMOVED</b> the Image [%s#%s]', $this->user->getId(), $this->user->getUsername(), $imageID, $imageOriginalName), 'image_removal', $this->user->getId());
 }
Пример #2
0
 public function removeRole(SubmitButton $button)
 {
     if (!$this->authorizator->isAllowed($this->user, 'user', 'remove')) {
         $this->flashMessage('authorization.noPermission', FlashMessage::WARNING);
         $this->redirect('this');
     }
     try {
         $this->userFacade->removeUser($this->pickedUser);
         $this->onSuccessUserRemoval($this->pickedUser);
     } catch (ForeignKeyConstraintViolationException $e) {
         $this->flashMessage('users.userRemoval.messages.cantBeRemoved', FlashMessage::WARNING, ['username' => $this->pickedUser->getUsername()]);
         $this->redirect('this');
     }
 }
Пример #3
0
 private function fillForm(Form $form, User $user)
 {
     $form['username']->setDefaultValue($user->getUsername());
     $form['email']->setDefaultValue($user->getEmail());
     $form['first_name']->setDefaultValue($user->getFirstName());
     $form['last_name']->setDefaultValue($user->getLastName());
     foreach ($user->getRoles() as $roleID => $role) {
         // todo
         $form['role']->setDefaultValue($roleID);
     }
 }
Пример #4
0
 public function onSuccessTagRemoval(Tag $tag, $id)
 {
     $this->appEventLogger->saveLog(sprintf('User [%s#%s] <b>has REMOVED</b> Tag [%s#%s]', $this->user->getId(), $this->user->getUsername(), $id, $tag->getName()), 'page_tag_removal', $this->user->getId());
 }
Пример #5
0
 public function onSuccessRolePermissionsEditing(Role $role)
 {
     $this->appEventLogger->saveLog(sprintf('User [%s#%s] <b>has EDITED</b> permissions of Role [%s#%s]', $this->user->getId(), $this->user->getUsername(), $role->getId(), $role->getName()), 'user_role_editing', $this->user->getId());
 }
Пример #6
0
 /**
  * @param string $formatString
  * @param Page $page
  * @return string
  * @throws \Nette\Application\UI\InvalidLinkException
  */
 private function createLogMessage($formatString, Page $page)
 {
     return sprintf($formatString, $this->user->getId(), $this->user->getUsername(), $this->linkGenerator->link('Pages:Front:Page:show', ['internal_id' => $page->getId()]), $page->isDraft() ? ' draft' : '', $page->getId(), $page->getTitle());
 }
Пример #7
0
 public function onSuccessUserRemoval(User $user)
 {
     $this->flashMessage('users.userRemoval.messages.success', FlashMessage::SUCCESS, ['username' => $user->getUsername()]);
     $this->redirect('Users:default');
 }