-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port the rest to new Authentication system
- Loading branch information
Showing
18 changed files
with
93 additions
and
183 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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
use Bramus\Router\Router; | ||
use daos\ItemOptions; | ||
use helpers\Authentication; | ||
use helpers\Authentication\AuthenticationService; | ||
use helpers\StringKeyedArray; | ||
use helpers\View; | ||
use helpers\ViewHelper; | ||
|
@@ -19,7 +19,7 @@ | |
* @author Tobias Zeising <[email protected]> | ||
*/ | ||
class Index { | ||
private Authentication $authentication; | ||
private AuthenticationService $authenticationService; | ||
private \daos\Items $itemsDao; | ||
private Router $router; | ||
private \daos\Sources $sourcesDao; | ||
|
@@ -28,8 +28,8 @@ class Index { | |
private View $view; | ||
private ViewHelper $viewHelper; | ||
|
||
public function __construct(Authentication $authentication, \daos\Items $itemsDao, Router $router, \daos\Sources $sourcesDao, Tags $tagsController, \daos\Tags $tagsDao, View $view, ViewHelper $viewHelper) { | ||
$this->authentication = $authentication; | ||
public function __construct(AuthenticationService $authenticationService, \daos\Items $itemsDao, Router $router, \daos\Sources $sourcesDao, Tags $tagsController, \daos\Tags $tagsDao, View $view, ViewHelper $viewHelper) { | ||
$this->authenticationService = $authenticationService; | ||
$this->itemsDao = $itemsDao; | ||
$this->router = $router; | ||
$this->sourcesDao = $sourcesDao; | ||
|
@@ -60,7 +60,7 @@ public function home(): void { | |
return; | ||
} | ||
|
||
$this->authentication->needsLoggedInOrPublicMode(); | ||
$this->authenticationService->ensureCanRead(); | ||
|
||
// load tags | ||
$tags = $this->tagsDao->getWithUnread(); | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
use daos\ItemOptions; | ||
use DateTimeInterface; | ||
use helpers\Authentication; | ||
use helpers\Authentication\AuthenticationService; | ||
use helpers\Misc; | ||
use helpers\Request; | ||
use helpers\View; | ||
|
@@ -20,18 +20,18 @@ | |
* @author Tobias Zeising <[email protected]> | ||
*/ | ||
class Items { | ||
private Authentication $authentication; | ||
private AuthenticationService $authenticationService; | ||
private \daos\Items $itemsDao; | ||
private Request $request; | ||
private View $view; | ||
|
||
public function __construct( | ||
Authentication $authentication, | ||
AuthenticationService $authenticationService, | ||
\daos\Items $itemsDao, | ||
Request $request, | ||
View $view | ||
) { | ||
$this->authentication = $authentication; | ||
$this->authenticationService = $authenticationService; | ||
$this->itemsDao = $itemsDao; | ||
$this->request = $request; | ||
$this->view = $view; | ||
|
@@ -44,7 +44,7 @@ public function __construct( | |
* @param ?string $itemId ID of item to mark as read | ||
*/ | ||
public function mark(?string $itemId = null): void { | ||
$this->authentication->needsLoggedIn(); | ||
$this->authenticationService->ensureIsPrivileged(); | ||
|
||
$ids = null; | ||
if ($itemId !== null) { | ||
|
@@ -84,7 +84,7 @@ public function mark(?string $itemId = null): void { | |
* @param string $itemId id of an item to mark as unread | ||
*/ | ||
public function unmark(string $itemId): void { | ||
$this->authentication->needsLoggedIn(); | ||
$this->authenticationService->ensureIsPrivileged(); | ||
|
||
try { | ||
$itemId = Misc::forceId($itemId); | ||
|
@@ -106,7 +106,7 @@ public function unmark(string $itemId): void { | |
* @param string $itemId id of an item to starr | ||
*/ | ||
public function starr(string $itemId): void { | ||
$this->authentication->needsLoggedIn(); | ||
$this->authenticationService->ensureIsPrivileged(); | ||
|
||
try { | ||
$itemId = Misc::forceId($itemId); | ||
|
@@ -127,7 +127,7 @@ public function starr(string $itemId): void { | |
* @param string $itemId id of an item to unstarr | ||
*/ | ||
public function unstarr(string $itemId): void { | ||
$this->authentication->needsLoggedIn(); | ||
$this->authenticationService->ensureIsPrivileged(); | ||
|
||
try { | ||
$itemId = Misc::forceId($itemId); | ||
|
@@ -146,7 +146,7 @@ public function unstarr(string $itemId): void { | |
* json | ||
*/ | ||
public function listItems(): void { | ||
$this->authentication->needsLoggedInOrPublicMode(); | ||
$this->authenticationService->ensureCanRead(); | ||
|
||
// parse params | ||
$options = ItemOptions::fromUser($_GET); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
namespace controllers\Opml; | ||
|
||
use helpers\Authentication; | ||
use helpers\Authentication\AuthenticationService; | ||
use helpers\Configuration; | ||
use helpers\SpoutLoader; | ||
use helpers\StringKeyedArray; | ||
|
@@ -19,16 +19,16 @@ | |
* @author Sean Rand <[email protected]> | ||
*/ | ||
class Export { | ||
private Authentication $authentication; | ||
private AuthenticationService $authenticationService; | ||
private Configuration $configuration; | ||
private Logger $logger; | ||
private SpoutLoader $spoutLoader; | ||
private \XMLWriter $writer; | ||
private \daos\Sources $sourcesDao; | ||
private \daos\Tags $tagsDao; | ||
|
||
public function __construct(Authentication $authentication, Configuration $configuration, Logger $logger, \daos\Sources $sourcesDao, SpoutLoader $spoutLoader, \daos\Tags $tagsDao, \XMLWriter $writer) { | ||
$this->authentication = $authentication; | ||
public function __construct(AuthenticationService $authenticationService, Configuration $configuration, Logger $logger, \daos\Sources $sourcesDao, SpoutLoader $spoutLoader, \daos\Tags $tagsDao, \XMLWriter $writer) { | ||
$this->authenticationService = $authenticationService; | ||
$this->configuration = $configuration; | ||
$this->logger = $logger; | ||
$this->sourcesDao = $sourcesDao; | ||
|
@@ -79,7 +79,7 @@ private function writeSource(array $source): void { | |
* @note Uses the selfoss namespace to store selfoss-specific information | ||
*/ | ||
public function export(): void { | ||
$this->authentication->needsLoggedIn(); | ||
$this->authenticationService->ensureIsPrivileged(); | ||
|
||
$this->logger->debug('start OPML export'); | ||
$this->writer->openMemory(); | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
use daos\ItemOptions; | ||
use FeedWriter\RSS2; | ||
use helpers\Authentication; | ||
use helpers\Authentication\AuthenticationService; | ||
use helpers\Configuration; | ||
use helpers\View; | ||
|
||
|
@@ -18,15 +18,15 @@ | |
* @author Tobias Zeising <[email protected]> | ||
*/ | ||
class Rss { | ||
private Authentication $authentication; | ||
private AuthenticationService $authenticationService; | ||
private Configuration $configuration; | ||
private RSS2 $feedWriter; | ||
private \daos\Items $itemsDao; | ||
private \daos\Sources $sourcesDao; | ||
private View $view; | ||
|
||
public function __construct(Authentication $authentication, Configuration $configuration, RSS2 $feedWriter, \daos\Items $itemsDao, \daos\Sources $sourcesDao, View $view) { | ||
$this->authentication = $authentication; | ||
public function __construct(AuthenticationService $authenticationService, Configuration $configuration, RSS2 $feedWriter, \daos\Items $itemsDao, \daos\Sources $sourcesDao, View $view) { | ||
$this->authenticationService = $authenticationService; | ||
$this->configuration = $configuration; | ||
$this->feedWriter = $feedWriter; | ||
$this->itemsDao = $itemsDao; | ||
|
@@ -38,7 +38,7 @@ public function __construct(Authentication $authentication, Configuration $confi | |
* rss feed | ||
*/ | ||
public function rss(): void { | ||
$this->authentication->needsLoggedInOrPublicMode(); | ||
$this->authenticationService->ensureCanRead(); | ||
|
||
$this->feedWriter->setTitle($this->configuration->rssTitle); | ||
$this->feedWriter->setChannelElement('description', ''); | ||
|
Oops, something went wrong.