From b48cbde5c0baebb3690d6fb79bd770cbb6649f53 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 24 Jun 2017 14:16:19 +0200 Subject: [PATCH] Move another trait out of obsolete Flarum\Core namespace --- .../core/src/Admin/Middleware/RequireAdministrateAbility.php | 2 +- .../core/src/Api/Controller/DeleteFaviconController.php | 2 +- framework/core/src/Api/Controller/DeleteLogoController.php | 2 +- .../src/Api/Controller/SendConfirmationEmailController.php | 2 +- .../core/src/Api/Controller/SetPermissionController.php | 2 +- framework/core/src/Api/Controller/SetSettingsController.php | 2 +- .../core/src/Api/Controller/UninstallExtensionController.php | 2 +- .../core/src/Api/Controller/UpdateExtensionController.php | 2 +- .../core/src/Api/Controller/UploadFaviconController.php | 2 +- framework/core/src/Api/Controller/UploadLogoController.php | 2 +- framework/core/src/Core/Command/CreateGroupHandler.php | 5 ++--- framework/core/src/Core/Command/DeleteAvatarHandler.php | 4 ++-- framework/core/src/Core/Command/DeleteDiscussionHandler.php | 4 ++-- framework/core/src/Core/Command/DeleteGroupHandler.php | 4 ++-- framework/core/src/Core/Command/DeletePostHandler.php | 4 ++-- framework/core/src/Core/Command/DeleteUserHandler.php | 4 ++-- framework/core/src/Core/Command/EditDiscussionHandler.php | 4 ++-- framework/core/src/Core/Command/EditGroupHandler.php | 4 ++-- framework/core/src/Core/Command/EditPostHandler.php | 4 ++-- framework/core/src/Core/Command/EditUserHandler.php | 4 ++-- framework/core/src/Core/Command/PostReplyHandler.php | 4 ++-- .../core/src/Core/Command/ReadAllNotificationsHandler.php | 2 +- framework/core/src/Core/Command/ReadDiscussionHandler.php | 4 ++-- framework/core/src/Core/Command/ReadNotificationHandler.php | 2 +- framework/core/src/Core/Command/RegisterUserHandler.php | 4 ++-- framework/core/src/Core/Command/StartDiscussionHandler.php | 4 ++-- framework/core/src/Core/Command/UploadAvatarHandler.php | 4 ++-- framework/core/src/Forum/Controller/LogOutController.php | 2 +- .../core/src/{Core/Access => User}/AssertPermissionTrait.php | 3 +-- 29 files changed, 44 insertions(+), 46 deletions(-) rename framework/core/src/{Core/Access => User}/AssertPermissionTrait.php (96%) diff --git a/framework/core/src/Admin/Middleware/RequireAdministrateAbility.php b/framework/core/src/Admin/Middleware/RequireAdministrateAbility.php index b52ab4163..b970e4d2e 100644 --- a/framework/core/src/Admin/Middleware/RequireAdministrateAbility.php +++ b/framework/core/src/Admin/Middleware/RequireAdministrateAbility.php @@ -11,7 +11,7 @@ namespace Flarum\Admin\Middleware; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Zend\Stratigility\MiddlewareInterface; diff --git a/framework/core/src/Api/Controller/DeleteFaviconController.php b/framework/core/src/Api/Controller/DeleteFaviconController.php index 00c38bb50..4c2807abc 100644 --- a/framework/core/src/Api/Controller/DeleteFaviconController.php +++ b/framework/core/src/Api/Controller/DeleteFaviconController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Foundation\Application; use Flarum\Settings\SettingsRepositoryInterface; use League\Flysystem\Adapter\Local; diff --git a/framework/core/src/Api/Controller/DeleteLogoController.php b/framework/core/src/Api/Controller/DeleteLogoController.php index 4e4cc016a..532674577 100644 --- a/framework/core/src/Api/Controller/DeleteLogoController.php +++ b/framework/core/src/Api/Controller/DeleteLogoController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Foundation\Application; use Flarum\Settings\SettingsRepositoryInterface; use League\Flysystem\Adapter\Local; diff --git a/framework/core/src/Api/Controller/SendConfirmationEmailController.php b/framework/core/src/Api/Controller/SendConfirmationEmailController.php index 02c22b020..a6314ad97 100644 --- a/framework/core/src/Api/Controller/SendConfirmationEmailController.php +++ b/framework/core/src/Api/Controller/SendConfirmationEmailController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\EmailToken; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Forum\UrlGenerator; diff --git a/framework/core/src/Api/Controller/SetPermissionController.php b/framework/core/src/Api/Controller/SetPermissionController.php index edbc7cf20..a11dc056f 100644 --- a/framework/core/src/Api/Controller/SetPermissionController.php +++ b/framework/core/src/Api/Controller/SetPermissionController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Group\Permission; use Flarum\Http\Controller\ControllerInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/framework/core/src/Api/Controller/SetSettingsController.php b/framework/core/src/Api/Controller/SetSettingsController.php index 09f23c6eb..b9cb59cdd 100644 --- a/framework/core/src/Api/Controller/SetSettingsController.php +++ b/framework/core/src/Api/Controller/SetSettingsController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Settings\Event\Serializing; use Flarum\Settings\Event\Saved; use Flarum\Http\Controller\ControllerInterface; diff --git a/framework/core/src/Api/Controller/UninstallExtensionController.php b/framework/core/src/Api/Controller/UninstallExtensionController.php index 4b9b185fb..0e2f02a59 100644 --- a/framework/core/src/Api/Controller/UninstallExtensionController.php +++ b/framework/core/src/Api/Controller/UninstallExtensionController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Extension\ExtensionManager; use Psr\Http\Message\ServerRequestInterface; diff --git a/framework/core/src/Api/Controller/UpdateExtensionController.php b/framework/core/src/Api/Controller/UpdateExtensionController.php index f9d983769..c701ae469 100644 --- a/framework/core/src/Api/Controller/UpdateExtensionController.php +++ b/framework/core/src/Api/Controller/UpdateExtensionController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Extension\ExtensionManager; use Flarum\Http\Controller\ControllerInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/framework/core/src/Api/Controller/UploadFaviconController.php b/framework/core/src/Api/Controller/UploadFaviconController.php index 1ccd5e088..80b33abee 100644 --- a/framework/core/src/Api/Controller/UploadFaviconController.php +++ b/framework/core/src/Api/Controller/UploadFaviconController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Foundation\Application; use Flarum\Settings\SettingsRepositoryInterface; use Illuminate\Support\Str; diff --git a/framework/core/src/Api/Controller/UploadLogoController.php b/framework/core/src/Api/Controller/UploadLogoController.php index ff49683f2..ed10a8b67 100644 --- a/framework/core/src/Api/Controller/UploadLogoController.php +++ b/framework/core/src/Api/Controller/UploadLogoController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Foundation\Application; use Flarum\Settings\SettingsRepositoryInterface; use Illuminate\Support\Str; diff --git a/framework/core/src/Core/Command/CreateGroupHandler.php b/framework/core/src/Core/Command/CreateGroupHandler.php index 299cf5804..ee152d1ec 100644 --- a/framework/core/src/Core/Command/CreateGroupHandler.php +++ b/framework/core/src/Core/Command/CreateGroupHandler.php @@ -11,8 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; -use Flarum\User\Exception\PermissionDeniedException; +use Flarum\User\AssertPermissionTrait; use Flarum\Group\Group; use Flarum\Foundation\DispatchEventsTrait; use Flarum\Group\GroupValidator; @@ -21,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher; class CreateGroupHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/DeleteAvatarHandler.php b/framework/core/src/Core/Command/DeleteAvatarHandler.php index 00961f741..2dfe68efd 100644 --- a/framework/core/src/Core/Command/DeleteAvatarHandler.php +++ b/framework/core/src/Core/Command/DeleteAvatarHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\User\UserRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -21,7 +21,7 @@ use League\Flysystem\FilesystemInterface; class DeleteAvatarHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/DeleteDiscussionHandler.php b/framework/core/src/Core/Command/DeleteDiscussionHandler.php index 4665db213..9643b5e96 100644 --- a/framework/core/src/Core/Command/DeleteDiscussionHandler.php +++ b/framework/core/src/Core/Command/DeleteDiscussionHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -20,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher; class DeleteDiscussionHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/DeleteGroupHandler.php b/framework/core/src/Core/Command/DeleteGroupHandler.php index 9755311cd..119758d1f 100644 --- a/framework/core/src/Core/Command/DeleteGroupHandler.php +++ b/framework/core/src/Core/Command/DeleteGroupHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Group\GroupRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -20,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher; class DeleteGroupHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/DeletePostHandler.php b/framework/core/src/Core/Command/DeletePostHandler.php index 541c5cb40..1e5301f2e 100644 --- a/framework/core/src/Core/Command/DeletePostHandler.php +++ b/framework/core/src/Core/Command/DeletePostHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Post\PostRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -20,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher; class DeletePostHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/DeleteUserHandler.php b/framework/core/src/Core/Command/DeleteUserHandler.php index d5ed6c15f..e2f64e482 100644 --- a/framework/core/src/Core/Command/DeleteUserHandler.php +++ b/framework/core/src/Core/Command/DeleteUserHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\User\UserRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -20,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher; class DeleteUserHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/EditDiscussionHandler.php b/framework/core/src/Core/Command/EditDiscussionHandler.php index bce27933e..038777d3e 100644 --- a/framework/core/src/Core/Command/EditDiscussionHandler.php +++ b/framework/core/src/Core/Command/EditDiscussionHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -21,7 +21,7 @@ use Illuminate\Contracts\Events\Dispatcher; class EditDiscussionHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/EditGroupHandler.php b/framework/core/src/Core/Command/EditGroupHandler.php index 1425f59df..c3fee99f4 100644 --- a/framework/core/src/Core/Command/EditGroupHandler.php +++ b/framework/core/src/Core/Command/EditGroupHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Group\Group; use Flarum\Group\GroupRepository; @@ -22,7 +22,7 @@ use Illuminate\Contracts\Events\Dispatcher; class EditGroupHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/EditPostHandler.php b/framework/core/src/Core/Command/EditPostHandler.php index 7bca65370..e2b093f9a 100644 --- a/framework/core/src/Core/Command/EditPostHandler.php +++ b/framework/core/src/Core/Command/EditPostHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Post\CommentPost; use Flarum\Post\PostRepository; use Flarum\Foundation\DispatchEventsTrait; @@ -21,7 +21,7 @@ use Illuminate\Contracts\Events\Dispatcher; class EditPostHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/EditUserHandler.php b/framework/core/src/Core/Command/EditUserHandler.php index 6071fa1ad..cb2b2b725 100644 --- a/framework/core/src/Core/Command/EditUserHandler.php +++ b/framework/core/src/Core/Command/EditUserHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\UserRepository; use Flarum\Foundation\DispatchEventsTrait; use Flarum\User\User; @@ -22,7 +22,7 @@ use Illuminate\Contracts\Events\Dispatcher; class EditUserHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/PostReplyHandler.php b/framework/core/src/Core/Command/PostReplyHandler.php index cb51c4fda..e4b3147e7 100644 --- a/framework/core/src/Core/Command/PostReplyHandler.php +++ b/framework/core/src/Core/Command/PostReplyHandler.php @@ -12,7 +12,7 @@ namespace Flarum\Core\Command; use DateTime; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Core\Notification\NotificationSyncer; use Flarum\Post\CommentPost; use Flarum\Discussion\DiscussionRepository; @@ -23,7 +23,7 @@ use Illuminate\Contracts\Events\Dispatcher; class PostReplyHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/ReadAllNotificationsHandler.php b/framework/core/src/Core/Command/ReadAllNotificationsHandler.php index 023568f9b..9269ed958 100644 --- a/framework/core/src/Core/Command/ReadAllNotificationsHandler.php +++ b/framework/core/src/Core/Command/ReadAllNotificationsHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Core\Repository\NotificationRepository; class ReadAllNotificationsHandler diff --git a/framework/core/src/Core/Command/ReadDiscussionHandler.php b/framework/core/src/Core/Command/ReadDiscussionHandler.php index 42e4722ea..9be64074b 100644 --- a/framework/core/src/Core/Command/ReadDiscussionHandler.php +++ b/framework/core/src/Core/Command/ReadDiscussionHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; use Flarum\Discussion\Event\UserDataSaving; @@ -19,7 +19,7 @@ use Illuminate\Contracts\Events\Dispatcher; class ReadDiscussionHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/ReadNotificationHandler.php b/framework/core/src/Core/Command/ReadNotificationHandler.php index b7da93198..f70f1d6b1 100644 --- a/framework/core/src/Core/Command/ReadNotificationHandler.php +++ b/framework/core/src/Core/Command/ReadNotificationHandler.php @@ -11,7 +11,7 @@ namespace Flarum\Core\Command; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Core\Notification; class ReadNotificationHandler diff --git a/framework/core/src/Core/Command/RegisterUserHandler.php b/framework/core/src/Core/Command/RegisterUserHandler.php index 2c3bdb931..edbf35d65 100644 --- a/framework/core/src/Core/Command/RegisterUserHandler.php +++ b/framework/core/src/Core/Command/RegisterUserHandler.php @@ -12,7 +12,7 @@ namespace Flarum\Core\Command; use Exception; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\AuthToken; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Foundation\DispatchEventsTrait; @@ -33,7 +33,7 @@ use League\Flysystem\MountManager; class RegisterUserHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/StartDiscussionHandler.php b/framework/core/src/Core/Command/StartDiscussionHandler.php index bad252625..7f8586031 100644 --- a/framework/core/src/Core/Command/StartDiscussionHandler.php +++ b/framework/core/src/Core/Command/StartDiscussionHandler.php @@ -12,7 +12,7 @@ namespace Flarum\Core\Command; use Exception; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\Discussion\Discussion; use Flarum\Foundation\DispatchEventsTrait; use Flarum\Discussion\DiscussionValidator; @@ -22,7 +22,7 @@ use Illuminate\Contracts\Events\Dispatcher as EventDispatcher; class StartDiscussionHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Core/Command/UploadAvatarHandler.php b/framework/core/src/Core/Command/UploadAvatarHandler.php index 791090e58..adcf76ee3 100644 --- a/framework/core/src/Core/Command/UploadAvatarHandler.php +++ b/framework/core/src/Core/Command/UploadAvatarHandler.php @@ -12,7 +12,7 @@ namespace Flarum\Core\Command; use Exception; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\UserRepository; use Flarum\Foundation\DispatchEventsTrait; use Flarum\User\AvatarValidator; @@ -29,7 +29,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; class UploadAvatarHandler { - use Flarum\Foundation\DispatchEventsTrait; + use DispatchEventsTrait; use AssertPermissionTrait; /** diff --git a/framework/core/src/Forum/Controller/LogOutController.php b/framework/core/src/Forum/Controller/LogOutController.php index c83601268..af220a6b6 100644 --- a/framework/core/src/Forum/Controller/LogOutController.php +++ b/framework/core/src/Forum/Controller/LogOutController.php @@ -11,7 +11,7 @@ namespace Flarum\Forum\Controller; -use Flarum\Core\Access\AssertPermissionTrait; +use Flarum\User\AssertPermissionTrait; use Flarum\User\Event\LoggedOut; use Flarum\Foundation\Application; use Flarum\Http\Controller\ControllerInterface; diff --git a/framework/core/src/Core/Access/AssertPermissionTrait.php b/framework/core/src/User/AssertPermissionTrait.php similarity index 96% rename from framework/core/src/Core/Access/AssertPermissionTrait.php rename to framework/core/src/User/AssertPermissionTrait.php index 647ca9fac..d6310440a 100644 --- a/framework/core/src/Core/Access/AssertPermissionTrait.php +++ b/framework/core/src/User/AssertPermissionTrait.php @@ -9,10 +9,9 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Access; +namespace Flarum\User; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\User\User; trait AssertPermissionTrait {