Skip to content

Commit

Permalink
Update NeosRequestPattern.php
Browse files Browse the repository at this point in the history
  • Loading branch information
anx-mwutte authored Oct 14, 2019
1 parent 40560c6 commit 0b4e523
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Classes/Security/NeosRequestPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
namespace Sandstorm\UserManagement\Security;

use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\RequestInterface;
use Neos\Flow\Security\RequestPatternInterface;

/**
* A request pattern that can detect and match "frontend" and "backend" mode
*/
class NeosRequestPattern implements RequestPatternInterface
{
const AREA_BACKEND = 'backend';
const AREA_FRONTEND = 'frontend';

/**
Expand All @@ -27,18 +25,15 @@ public function __construct(array $options)
}

/**
* Matches a \Neos\Flow\Mvc\RequestInterface against its set pattern rules
* Matches a \Neos\Flow\Mvc\ActionRequest against its set pattern rules
*
* @param RequestInterface $request The request that should be matched
* @param ActionRequest $request The request that should be matched
* @return boolean TRUE if the pattern matched, FALSE otherwise
*/
public function matchRequest(RequestInterface $request)
public function matchRequest(ActionRequest $request)
{
$shouldMatchBackend = ($this->options['area'] === self::AREA_FRONTEND) ? false : true;

if (!$request instanceof ActionRequest) {
return false;
}
$requestPath = $request->getHttpRequest()->getUri()->getPath();
$requestPathMatchesBackend = substr($requestPath, 0, 5) === '/neos' || substr($requestPath, 0, 6) === '/setup' || strpos($requestPath, '@') !== false;

Expand Down

0 comments on commit 0b4e523

Please sign in to comment.