From 93bc1c6c23327678661a01590be006b4ace1dbc7 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Wed, 5 Jun 2019 19:43:45 +0800 Subject: [PATCH] Rename auth bundle generator and voter #194 --- catalyst/api-bundle/Access/Generator.php | 2 +- catalyst/api-bundle/Access/Voter.php | 2 +- .../auth-bundle/Service/{Generator.php => ACLGenerator.php} | 2 +- catalyst/auth-bundle/Service/{Voter.php => ACLVoter.php} | 4 ++-- config/services.yaml | 5 ++--- src/Controller/RoleController.php | 2 +- src/Controller/TestController.php | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) rename catalyst/auth-bundle/Service/{Generator.php => ACLGenerator.php} (99%) rename catalyst/auth-bundle/Service/{Voter.php => ACLVoter.php} (91%) diff --git a/catalyst/api-bundle/Access/Generator.php b/catalyst/api-bundle/Access/Generator.php index a4926a51..20d60b74 100644 --- a/catalyst/api-bundle/Access/Generator.php +++ b/catalyst/api-bundle/Access/Generator.php @@ -2,7 +2,7 @@ namespace Catalyst\APIBundle\Access; -use Catalyst\AuthBundle\Service\Generator as BaseGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as BaseGenerator; class Generator extends BaseGenerator { diff --git a/catalyst/api-bundle/Access/Voter.php b/catalyst/api-bundle/Access/Voter.php index 215ac2f9..e96995b4 100644 --- a/catalyst/api-bundle/Access/Voter.php +++ b/catalyst/api-bundle/Access/Voter.php @@ -2,7 +2,7 @@ namespace Catalyst\APIBundle\Access; -use Catalyst\AuthBundle\Service\Voter as BaseVoter; +use Catalyst\AuthBundle\Service\ACLVoter as BaseVoter; class Voter extends BaseVoter { diff --git a/catalyst/auth-bundle/Service/Generator.php b/catalyst/auth-bundle/Service/ACLGenerator.php similarity index 99% rename from catalyst/auth-bundle/Service/Generator.php rename to catalyst/auth-bundle/Service/ACLGenerator.php index b12f71ac..e2270ad9 100644 --- a/catalyst/auth-bundle/Service/Generator.php +++ b/catalyst/auth-bundle/Service/ACLGenerator.php @@ -9,7 +9,7 @@ use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Routing\RouterInterface; -class Generator +class ACLGenerator { protected $router; protected $cache_dir; diff --git a/catalyst/auth-bundle/Service/Voter.php b/catalyst/auth-bundle/Service/ACLVoter.php similarity index 91% rename from catalyst/auth-bundle/Service/Voter.php rename to catalyst/auth-bundle/Service/ACLVoter.php index 3d23c4ec..c44737ce 100644 --- a/catalyst/auth-bundle/Service/Voter.php +++ b/catalyst/auth-bundle/Service/ACLVoter.php @@ -6,13 +6,13 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Voter as BaseVoter; use Symfony\Component\Security\Core\Security; -class Voter extends BaseVoter +class ACLVoter extends BaseVoter { protected $acl_gen; protected $user_class; protected $security; - public function __construct(Security $security, Generator $acl_gen, $user_class) + public function __construct(Security $security, ACLGenerator $acl_gen, $user_class) { $this->acl_gen = $acl_gen; $this->user_class = $user_class; diff --git a/config/services.yaml b/config/services.yaml index 5dccbb13..79bb6314 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -40,7 +40,7 @@ services: $cache_dir: "%kernel.cache_dir%" $config_dir: "%kernel.root_dir%/../config" - Catalyst\AuthBundle\Service\Generator: + Catalyst\AuthBundle\Service\ACLGenerator: arguments: $router: "@router.default" $cache_dir: "%kernel.cache_dir%" @@ -48,9 +48,8 @@ services: $acl_file: "%app_acl_file%" $acl_key: "%app_access_key%" - Catalyst\AuthBundle\Service\Voter: + Catalyst\AuthBundle\Service\ACLVoter: arguments: - $acl_gen: "@Catalyst\\AuthBundle\\Service\\Generator" $user_class: "App\\Entity\\User" tags: ['security.voter'] diff --git a/src/Controller/RoleController.php b/src/Controller/RoleController.php index 3da8e95f..f8299cbc 100644 --- a/src/Controller/RoleController.php +++ b/src/Controller/RoleController.php @@ -12,7 +12,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use App\Menu\Generator as MenuGenerator; -use Catalyst\AuthBundle\Service\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator; class RoleController extends BaseController { diff --git a/src/Controller/TestController.php b/src/Controller/TestController.php index a5c1e383..53006ccf 100644 --- a/src/Controller/TestController.php +++ b/src/Controller/TestController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Ramcar\BaseController; -use Catalyst\AuthBundle\Service\Generator; +use Catalyst\AuthBundle\Service\ACLGenerator; use CrEOF\Spatial\PHP\Types\Geometry\Point; @@ -14,7 +14,7 @@ use Doctrine\Common\Util\Debug; class TestController extends BaseController { - public function index(Generator $acl_gen) + public function index(ACLGenerator $acl_gen) { $params = $this->initParameters('home');