-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoph Lehmann
committed
Sep 22, 2019
1 parent
91d49eb
commit 51fee17
Showing
7 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
namespace T3Monitor\T3monitoring\Resolver; | ||
|
||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class BackendUserResolver extends BaseResolver | ||
{ | ||
const TITLE = 'Backend user'; | ||
|
||
public function setValueForComparison() | ||
{ | ||
$this->valueForComparison = $this->resolverData->getResponse()['backendUser']; | ||
} | ||
|
||
public function getProviderArguments() | ||
{ | ||
return GeneralUtility::trimExplode(PHP_EOL, $this->argument, true); | ||
} | ||
|
||
protected function isActiveOperator() | ||
{ | ||
if (!isset($this->resolverData->getResponse()['backendUser'])) { | ||
return; | ||
} | ||
|
||
$unwantedActiveUsers = array_intersect($this->getProviderArguments(), | ||
$this->resolverData->getResponse()['backendUser']); | ||
|
||
if (count($unwantedActiveUsers) > 0) { | ||
$this->addRuleData($unwantedActiveUsers); | ||
} | ||
return $unwantedActiveUsers !== 0; | ||
} | ||
|
||
protected function addRuleData($backendUsers) | ||
{ | ||
$update = $this->resolverData->getResponse(); | ||
$messageCategory = $this->resolverData->getRule()->getMessageCategory(); | ||
$update['extra'][$messageCategory][$this->resolverData->getRule()->getTitle()] = implode(',', | ||
$backendUsers); | ||
$this->resolverData->setResponse($update); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters