Skip to content

Commit

Permalink
feat(middleware): Allow to easily jump from the Attribute to the Midd…
Browse files Browse the repository at this point in the history
…leware

Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Feb 21, 2024
1 parent 8f97f63 commit 2265ea3
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Middleware/Attribute/RequireCallEnabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\CanUseTalkMiddleware;

/**
* Attribute to check limit endpoint access when the app config start_calls is not enabled
* @see CanUseTalkMiddleware::beforeController()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireCallEnabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getLoggedIn()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireLoggedInModeratorParticipant extends RequireModeratorParticipant {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireLoggedInParticipant.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getLoggedIn()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireLoggedInParticipant extends RequireParticipant {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireModeratorOrNoLobby.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::checkLobbyState()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireModeratorOrNoLobby extends RequireRoom {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireModeratorParticipant.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getLoggedInOrGuest()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireModeratorParticipant extends RequireParticipant {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireParticipant.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getLoggedInOrGuest()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireParticipant extends RequireRoom {
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getLoggedInOrGuest()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireParticipantOrLoggedInAndListedConversation extends RequireRoom {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequirePermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::checkPermission()
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class RequirePermission {

Expand Down
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireReadWriteConversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::checkReadOnlyState()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireReadWriteConversation extends RequireRoom {
}
4 changes: 4 additions & 0 deletions lib/Middleware/Attribute/RequireRoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
namespace OCA\Talk\Middleware\Attribute;

use Attribute;
use OCA\Talk\Middleware\InjectionMiddleware;

/**
* @see InjectionMiddleware::getRoom()
*/
#[Attribute(Attribute::TARGET_METHOD)]
class RequireRoom {
}

0 comments on commit 2265ea3

Please sign in to comment.