hdknr / note

Markdown Texts
http://qiita.com/hidelafoglia
7 stars 1 forks source link

mautic #52

Open hdknr opened 6 years ago

hdknr commented 6 years ago

サイトURL

ランディングページ

インストール

メール

日付

hdknr commented 5 years ago

「リクエストされたエリア/アクションへのアクセス権がありません。」問題

http://localhost/pr/s/forms/field/new?type=email&tmpl=field&formId=1&inBuilder=1&_=1533856018141&mauticUserLastActive=1&mauticLastNotificatastNotificationId=

You do not have access to the requested area/action.

{'error': 'リクエストされたエリア\\/アクションへのアクセス権がありません。'}
 'mautic.core.error.accessdenied' => 'You do not have access to the requested area/action.'
$ find . -name "*.php" -exec grep -H mautic.core.error.accessdenied {} \;

./app/bundles/ApiBundle/Controller/CommonApiController.php:                $this->setBatchError($key, 'mautic.core.error.accessdenied', Codes::HTTP_FORBIDDEN, $errors, $entities, $entity);
./app/bundles/ApiBundle/Controller/CommonApiController.php:                    $this->setBatchError($key, 'mautic.core.error.accessdenied', Codes::HTTP_FORBIDDEN, $errors, $entities, $entity);
./app/bundles/ApiBundle/Controller/CommonApiController.php:                $this->setBatchError($key, 'mautic.core.error.accessdenied', Codes::HTTP_FORBIDDEN, $errors, $entities, $entity);
./app/bundles/ApiBundle/Controller/CommonApiController.php:                    $this->setBatchError($key, 'mautic.core.error.accessdenied', Codes::HTTP_FORBIDDEN, $errors, $entities, $entity);
./app/bundles/ApiBundle/Controller/CommonApiController.php:    protected function accessDenied($msg = 'mautic.core.error.accessdenied')
./app/bundles/ApiBundle/EventListener/OAuthEventListener.php:                throw new AccessDeniedException($this->translator->trans('mautic.core.error.accessdenied', [], 'flashes'));

カレンダーのドラッグドロップ更新エラー:

./app/bundles/CalendarBundle/Controller/AjaxController.php:            $this->addFlash('mautic.core.error.accessdenied', 'error');
./app/bundles/CoreBundle/Controller/CommonController.php:                'msg'  => $this->translator->trans('mautic.core.error.accessdenied', [], 'flashes'),
./app/bundles/CoreBundle/Controller/CommonController.php:    public function modalAccessDenied($msg = 'mautic.core.error.accessdenied')

HttpXMLRequest以外はエラー:

./app/bundles/FormBundle/Controller/FormController.php:            $html = '<h1>'.$this->get('translator')->trans('mautic.core.error.accessdenied', [], 'flashes').'</h1>';

mautic.core.error.accessdenied が modalAccessDenied() から出されている。

array (size=13)
  0 => 
    array (size=7)
      'file' => string '/vagrant/projects/taberu/landing/mautic/app/bundles/FormBundle/Controller/FieldController.php' (length=93)
      'line' => int 55
      'function' => string 'modalAccessDenied' (length=17)
      'class' => string 'Mautic\CoreBundle\Controller\CommonController' (length=45)
      'object' => 
        object(Mautic\FormBundle\Controller\FieldController)[724]
          private 'deprecatedModelName' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedPermissionBase' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedRouteBase' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedSessionBase' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedTranslationBase' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedTemplateBase' (Mautic\CoreBundle\Controller\FormController) => null
          private 'deprecatedMauticContent' (Mautic\CoreBundle\Controller\FormController) => null
          protected 'activeLink' => null
          protected 'permissionBase' => null
          protected 'factory' => 
            object(Mautic\CoreBundle\Factory\MauticFactory)[157]
              ...
          protected 'request' => 
            object(Symfony\Component\HttpFoundation\Request)[4]
              ...
          protected 'user' => 
            object(Mautic\UserBundle\Entity\User)[738]
              ...
          protected 'coreParametersHelper' => 
            object(Mautic\CoreBundle\Helper\CoreParametersHelper)[140]
              ...
          protected 'dispatcher' => 
            object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher)[154]
              ...
          protected 'translator' => 
            object(Mautic\CoreBundle\Translation\Translator)[151]
              ...
          protected 'container' => 
            object(appProdProjectContainer)[78]
              ...
      'type' => string '->' (length=2)
      'args' => 
        array (size=0)
          empty

これは、app/bundles/FormBundle/Controller/FieldController.php で、 HttpXmlRequest じゃない場合、フィールドの追加のリクエストを受け付けない、というエラー。ブラウザのアドレスフィールドでリクエストしたらそうなる。

が、error にスタックのファイル名を入れてフォームエディタから送信したら /vagrant/projects/taberu/landing/mautic/app/bundles/FormBundle/Controller/FieldController.php を返したので同じなのでは。

    public function newAction()
    {
        ....
        //ajax only for form fields
        if (!$fieldType ||
            !$this->request->isXmlHttpRequest() ||
            !$this->get('mautic.security')->isGranted(['form:forms:editown', 'form:forms:editother', 'form:forms:create'], 'MATCH_ONE')
        ) {
            return $this->modalAccessDenied();
        }   
        ...

X_Requested_With ヘッダーパラメータ

XMLHttpRequestかどうかは、リクエストヘッダのX-Requested-WithがXMLHttpRequestかどうかによって判断しているようです。 :

    public function isXmlHttpRequest()
    {
        return 'XMLHttpRequest' == $this->headers->get('X-Requested-With');
    }

nginxの設定変えたが変わらず:

fastcgi_param   HTTP_X_REQUESTED_WITH   $http_x_requested_with;  

Mautic(Symphony)には渡っているっぽい:

var_export($_SERVER, true)
array (
  ....
  'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest',
  ...
)

フォームフィールドタイプ

nginxの問題:

  try_files $uri $uri/ /pr/index.php$1?$query_string;