Beispiel #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());
 }
Beispiel #2
0
 public function actionUserRemove($id)
 {
     $this->pickedUser = $this->getPickedUser($id);
     if ($this->userEntity->getId() === $this->pickedUser->getId()) {
         $this->flashMessage('users.userRemoval.messages.removeYourself', FlashMessage::WARNING);
         $this->redirect('Users:default');
     }
     $this['pageTitle']->setPageTitle('users.userRemoval.title');
 }
Beispiel #3
0
 /**
  * @param array $values
  * @param User $user
  * @return ValidationObject
  * @throws \Exception
  */
 public function save(array $values, User $user = null)
 {
     foreach ($values as $key => $value) {
         $values[$key] = $value !== '' ? $value : null;
     }
     try {
         if (isset($user) and $user->getId() !== null) {
             $validationObject = $this->update($values, $user);
         } else {
             $validationObject = $this->create($values, $user);
         }
     } catch (\Exception $e) {
         $this->em->rollback();
         $this->em->close();
         // todo log
         throw $e;
     }
     if ($validationObject->isValid()) {
         $validationObject->setResult($user);
     }
     return $validationObject;
 }
Beispiel #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());
 }
Beispiel #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());
 }
Beispiel #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());
 }
Beispiel #7
0
 /**
  * Remove the given OAuth2 identity from the given user.
  */
 static function removeIdentity(\Db\Connection $db, User $user, $provider, $uid)
 {
     if (!$user) {
         throw new \InvalidArgumentException("No user provided.");
     }
     $q = $db->prepare("DELETE FROM user_oauth2_identities WHERE user_id=? AND provider=? AND uid=? LIMIT 1");
     return $q->execute(array($user->getId(), $provider, $uid));
 }
Beispiel #8
0
 /**
  * @return int
  */
 public function getAuthorId()
 {
     return $this->author->getId();
 }