From 876722ebe7c9a65e9d887f4a7cdedbdc0c369f01 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Fri, 3 Feb 2023 14:45:38 +0800 Subject: [PATCH 01/76] Switch over to newer catalyst libs, update service configs #730 --- catalyst/api-bundle/Access/Generator.php | 9 - catalyst/api-bundle/Access/Voter.php | 10 - catalyst/api-bundle/CatalystAPIBundle.php | 9 - .../api-bundle/Command/TestAPICommand.php | 155 ----- catalyst/api-bundle/Command/TestCommand.php | 104 --- .../api-bundle/Command/UserCreateCommand.php | 49 -- catalyst/api-bundle/Connector/Client.php | 151 ----- .../api-bundle/Controller/APIController.php | 42 -- .../DataFixtures/APIRoleFixtures.php | 20 - catalyst/api-bundle/Entity/Role.php | 28 - catalyst/api-bundle/Entity/User.php | 186 ------ catalyst/api-bundle/Response/APIResponse.php | 20 - .../Security/APIKeyAuthenticator.php | 160 ----- .../Security/APIKeyUserProvider.php | 62 -- .../Service/AccessDeniedHandler.php | 18 - composer.json | 18 +- composer.lock | 298 ++++----- config/bundles.php | 5 +- config/cmb.services.yaml | 58 -- config/packages/catalyst_auth.yaml | 616 ++++++++++++++++++ config/packages/catalyst_menu.yaml | 268 ++++++++ config/packages/security.yaml | 33 +- config/resq.services.yaml | 58 -- config/services.yaml | 58 -- src/Command/CreateRiderAPIUserCommand.php | 4 +- src/Controller/APIRoleController.php | 6 +- src/Controller/APIUserController.php | 4 +- src/Controller/CAPI/BatteryController.php | 6 +- src/Controller/CAPI/CustomerController.php | 6 +- .../CAPI/CustomerWarrantyController.php | 6 +- src/Controller/CAPI/DealerController.php | 6 +- .../CAPI/MunicipalityController.php | 6 +- .../CAPI/PrivacyPolicyController.php | 6 +- src/Controller/CAPI/RiderAppController.php | 6 +- src/Controller/CAPI/TestController.php | 4 +- src/Controller/CAPI/VehicleController.php | 6 +- src/Controller/CAPI/WarrantyController.php | 6 +- .../CAPI/WarrantySerialController.php | 6 +- src/Controller/RiderController.php | 4 +- src/Controller/TAPI/BatteryController.php | 6 +- src/Controller/TAPI/JobOrderController.php | 6 +- src/Controller/TAPI/PromoController.php | 6 +- src/Controller/TAPI/ServiceController.php | 6 +- src/Controller/TAPI/VehicleController.php | 6 +- src/Entity/Rider.php | 4 +- symfony.lock | 18 +- templates/base.html.twig | 3 +- templates/menu.html.twig | 60 +- translations/messages.en.yaml | 74 +++ 49 files changed, 1206 insertions(+), 1500 deletions(-) delete mode 100644 catalyst/api-bundle/Access/Generator.php delete mode 100644 catalyst/api-bundle/Access/Voter.php delete mode 100644 catalyst/api-bundle/CatalystAPIBundle.php delete mode 100644 catalyst/api-bundle/Command/TestAPICommand.php delete mode 100644 catalyst/api-bundle/Command/TestCommand.php delete mode 100644 catalyst/api-bundle/Command/UserCreateCommand.php delete mode 100644 catalyst/api-bundle/Connector/Client.php delete mode 100644 catalyst/api-bundle/Controller/APIController.php delete mode 100644 catalyst/api-bundle/DataFixtures/APIRoleFixtures.php delete mode 100644 catalyst/api-bundle/Entity/Role.php delete mode 100644 catalyst/api-bundle/Entity/User.php delete mode 100644 catalyst/api-bundle/Response/APIResponse.php delete mode 100644 catalyst/api-bundle/Security/APIKeyAuthenticator.php delete mode 100644 catalyst/api-bundle/Security/APIKeyUserProvider.php delete mode 100644 catalyst/api-bundle/Service/AccessDeniedHandler.php create mode 100644 config/packages/catalyst_auth.yaml create mode 100644 config/packages/catalyst_menu.yaml diff --git a/catalyst/api-bundle/Access/Generator.php b/catalyst/api-bundle/Access/Generator.php deleted file mode 100644 index 20d60b74..00000000 --- a/catalyst/api-bundle/Access/Generator.php +++ /dev/null @@ -1,9 +0,0 @@ -setName('api:test-connector-all') - ->setDescription('Test API connector with all commands.') - ->setHelp('Test API Connector with all commands.') - ->addArgument('protocol', InputArgument::REQUIRED, 'protocol') - ->addArgument('server', InputArgument::REQUIRED, 'server') - ->addArgument('api_key', InputArgument::REQUIRED, 'api_key') - ->addArgument('secret_key', InputArgument::REQUIRED, 'secret_key'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $protocol = $input->getArgument('protocol'); - $server = $input->getArgument('server'); - $api_key = $input->getArgument('api_key'); - $secret_key = $input->getArgument('secret_key'); - - // api client - $api = new APIClient($server, $api_key, $secret_key); - $api->setProtocol($protocol); - - // test - $api->get('/capi/test'); - - // TODO: shift this out of the bundle, since it's project specific - - // warranty register - $serial = 'AJ34LJADR12134LKJL5'; - $plate_num = 'XEN918'; - $params = [ - 'serial' => $serial, - 'plate_number' => $plate_num, - 'warranty_class' => 'private', - 'sku' => 'WMEB24CB-CPN00-LX', - 'date_purchase' => '20181001', - 'date_expire' => '20191001', - 'first_name' => 'First', - 'last_name' => 'Last', - 'mobile_number' => '09231234567', - ]; - //$api->post('/capi/warranties', $params); - - // get all warranties - $params = [ - 'order' => 'DESC', - 'limit' => '5', - 'start' => '1', - ]; - - //$api->get('/capi/warranties', $params); - - - // warranty find - //$api->get('/capi/warranties/' . $serial); - - // warranty update - $id = 86811; - $params = [ - 'serial' => $serial, - 'plate_number' => $plate_num, - 'warranty_class' => 'private', - 'sku' => 'WMEB24CB-CPN00-LX', - 'date_purchase' => '20181001', - 'date_expire' => '20191001', - 'first_name' => 'First', - 'last_name' => 'Last', - 'mobile_number' => '123456789111', - ]; - //$api->post('/capi/warranties/'. $id, $params); - - // warranty set privacy policy - $id = 86811; - $policy_id = 2; - $params = [ - 'privacy_policy_id' => $policy_id, - ]; - //$api->post('/capi/warranties/' . $id .'/privacypolicy', $params); - - // warranty claim - $id = 86811; - $serial = 'AJ34LJADR12134LKJL5'; - $params = [ - 'serial' => $serial, - ]; - //$api->post('/capi/warranties/' . $id . '/claim', $params); - - // warranty cancel - $id = 86811; - //$api->get('/capi/warranties/' . $id . '/cancel'); - - // plate warranty - //$api->get('/capi/plates/' . $plate_num . '/warranties'); - - // warranty delete - $id = 86811; - //$api->post('/capi/warranties/' . $id . '/delete'); - - // battery - //$api->get('/capi/battery_brands'); - //$api->get('/capi/battery_sizes'); - //$api->get('/capi/batteries'); - - // vehicle - //$api->get('/capi/vehicle_manufacturers'); - //$api->get('/capi/vehicles'); - - // privacy policy - $privacy_policy_id = 2; - //$api->get('/capi/privacy_policy/' . $privacy_policy_id ); - - // register new customer - $params = [ - 'first_name' => 'Krispups', - 'last_name' =>'Porzindog', - 'mobile_number' => '9221111111', - 'v_make_id' => '22241', - 'v_model_year' => '2018', - 'v_plate_number' => 'KPP1234', - 'v_color' => 'White', - 'v_condition' => 'new', - 'v_fuel_type' => 'gas', - ]; - //$api->post('/capi/quick_registration', $params); - - // get warranties given list of serial numbers - $serial_list = [ - 'AJ34LJADR12134LKJM4', - 'AJ34LJADR12134LKJL5', - 'test', - ]; - - $params = [ - 'serial_list' => $serial_list, - ]; - - $api->post('/capi/warranties_list', $params); - } -} diff --git a/catalyst/api-bundle/Command/TestCommand.php b/catalyst/api-bundle/Command/TestCommand.php deleted file mode 100644 index 3d03ae0d..00000000 --- a/catalyst/api-bundle/Command/TestCommand.php +++ /dev/null @@ -1,104 +0,0 @@ -setName('api:test-connector') - ->setDescription('Test API connector.') - ->setHelp('Test API Connector.') - ->addArgument('protocol', InputArgument::REQUIRED, 'protocol') - ->addArgument('server', InputArgument::REQUIRED, 'server') - ->addArgument('api_key', InputArgument::REQUIRED, 'api_key') - ->addArgument('secret_key', InputArgument::REQUIRED, 'secret_key'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $protocol = $input->getArgument('protocol'); - $server = $input->getArgument('server'); - $api_key = $input->getArgument('api_key'); - $secret_key = $input->getArgument('secret_key'); - - // api client - $api = new APIClient($server, $api_key, $secret_key); - $api->setProtocol($protocol); - - // test - $api->get('/capi/test'); - - // TODO: shift this out of the bundle, since it's project specific - - - // warranty register - $serial = 'AJ34LJADR12134LKJL5'; - $plate_num = 'XEN918'; - $params = [ - 'serial' => $serial, - 'plate_number' => $plate_num, - 'warranty_class' => 'private', - 'sku' => 'WMEB24CB-CPN00-LX', - 'date_purchase' => '20181001', - 'date_expire' => '20191001', - 'first_name' => 'First', - 'last_name' => 'Last', - 'mobile_number' => '12345678910', - ]; - $api->post('/capi/warranties', $params); - - // get all warranties - $api->get('/capi/warranties'); - - - /* - // warranty find - $api->get('/capi/warranties/' . $serial); - */ - - // warranty claim - $id = 86811; - $serial = 'AJ34LJADR12134LKJL'; - $params = [ - 'serial' => $serial, - ]; - $api->post('/capi/warranties/' . $id . '/claim', $params); - - // add battery - $sku = 'WZMB31QT-CPP00-S'; - $brand_id = '4'; - $size_id = '1'; - $params = [ - 'sku' => $sku, - 'brand_id' => $brand_id, - 'size_id' => $size_id, - ]; - $api->post('/capi/batteries', $params); - - /* - - // plate warranty - $api->get('/capi/plates/' . $plate_num . '/warranties'); - - // battery - $api->get('/capi/battery_brands'); - $api->get('/capi/battery_sizes'); - $api->get('/capi/batteries'); - - // vehicle - // $api->get('/capi/vehicle_manufacturers'); - // $api->get('/capi/vehicles'); - */ - } -} diff --git a/catalyst/api-bundle/Command/UserCreateCommand.php b/catalyst/api-bundle/Command/UserCreateCommand.php deleted file mode 100644 index cea9682c..00000000 --- a/catalyst/api-bundle/Command/UserCreateCommand.php +++ /dev/null @@ -1,49 +0,0 @@ -em = $em; - - parent::__construct(); - } - - protected function configure() - { - $this->setName('api:user-create') - ->setDescription('Create new API user.') - ->setHelp('Creates new API user and saves to database.') - ->addArgument('name', InputArgument::REQUIRED, 'name'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $name = $input->getArgument('name'); - - $user = new User(); - $user->setName($name); - - $this->em->persist($user); - $this->em->flush(); - - $output->write('API Key - ' . $user->getAPIKey() . "\n"); - $output->write('Secret Key - ' . $user->getSecretKey() . "\n"); - } - - -} diff --git a/catalyst/api-bundle/Connector/Client.php b/catalyst/api-bundle/Connector/Client.php deleted file mode 100644 index 904b7cad..00000000 --- a/catalyst/api-bundle/Connector/Client.php +++ /dev/null @@ -1,151 +0,0 @@ -protocol = 'https'; - $this->port = null; - - $this->server = $server; - $this->api_key = $api_key; - $this->secret_key = $secret_key; - $this->curl = curl_init(); - } - - public function __destruct() - { - curl_close($this->curl); - } - - public function setProtocol($protocol) - { - if ($protocol != 'http' && $protocol != 'https') - return $this; - - $this->protocol = $protocol; - return $this; - } - - protected function getDateString() - { - $date = new DateTime(); - return $date->format(self::DATE_FORMAT); - } - - public function get($url, $params = []) - { - curl_reset($this->curl); - - $date_string = $this->getDateString(); - $headers = $this->generateHeaders('GET', $url, $date_string); - - // build query string - if (count($params) > 0) - $query_string = '?' . http_build_query($params); - else - $query_string = ''; - - // build url - if ($this->port == null) - $full_url = $this->protocol . '://' . $this->server . $url . $query_string; - else - $full_url = $this->protocol . '://' . $this->server . ':' . $this->port . $url . $query_string; - - error_log($full_url); - - // curl - // curl_setopt($this->curl, CURLOPT_VERBOSE, true); - curl_setopt($this->curl, CURLOPT_URL, $full_url); - curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($this->curl, CURLOPT_USERAGENT, self::USER_AGENT); - curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($this->curl, CURLOPT_TIMEOUT, 0); - - $res = curl_exec($this->curl); - error_log($res); - } - - public function post($url, $params = []) - { - curl_reset($this->curl); - - $date_string = $this->getDateString(); - $headers = $this->generateHeaders('POST', $url, $date_string); - - // build query string - $query_string = http_build_query($params); - - // build url - if ($this->port == null) - $full_url = $this->protocol . '://' . $this->server . $url; - else - $full_url = $this->protocol . '://' . $this->server . ':' . $this->port . $url; - - error_log($full_url); - - // curl - // curl_setopt($this->curl, CURLOPT_VERBOSE, true); - curl_setopt($this->curl, CURLOPT_URL, $full_url); - curl_setopt($this->curl, CURLOPT_POST, true); - curl_setopt($this->curl, CURLOPT_POSTFIELDS, $query_string); - curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($this->curl, CURLOPT_USERAGENT, self::USER_AGENT); - curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($this->curl, CURLOPT_TIMEOUT, 0); - - $res = curl_exec($this->curl); - error_log($res); - } - - protected function generateSignature($method, $url, $date_string) - { - $creds = [ - $method, - $url, - $date_string, - $this->secret_key, - ]; - $sig_source = implode('|', $creds); - - error_log('SIG SOURCE - ' . $sig_source); - - $raw_sig = hash_hmac('sha1', $sig_source, $this->secret_key, true); - $enc_sig = base64_encode($raw_sig); - - return $enc_sig; - } - - protected function generateHeaders($method, $url, $date_string) - { - $sig = $this->generateSignature($method, $url, $date_string); - - $headers = [ - self::HEADER_API_KEY . ': ' . $this->api_key, - self::HEADER_SIGNATURE . ': ' . $sig, - self::HEADER_DATE . ': ' . $date_string, - ]; - - return $headers; - } -} diff --git a/catalyst/api-bundle/Controller/APIController.php b/catalyst/api-bundle/Controller/APIController.php deleted file mode 100644 index 74c63d3c..00000000 --- a/catalyst/api-bundle/Controller/APIController.php +++ /dev/null @@ -1,42 +0,0 @@ -getMethod() == 'GET') - { - $check = $req->query->get($param); - if (empty($check)) - $missing[] = $param; - } - // else if ($req->getMethod() == 'POST') - else - { - $check = $req->request->get($param); - //if (empty($check)) - if (!isset($check)) - $missing[] = $param; - } - } - - // check missing parameters - if (count($missing) > 0) - { - $miss_string = implode(', ', $missing); - return 'Missing required parameter(s): ' . $miss_string; - } - - return false; - } -} diff --git a/catalyst/api-bundle/DataFixtures/APIRoleFixtures.php b/catalyst/api-bundle/DataFixtures/APIRoleFixtures.php deleted file mode 100644 index 00b4c3e0..00000000 --- a/catalyst/api-bundle/DataFixtures/APIRoleFixtures.php +++ /dev/null @@ -1,20 +0,0 @@ -setID(Role::SUPER_ADMIN) - ->setName('Super Administrator'); - $em->persist($role); - $em->flush(); - } -} diff --git a/catalyst/api-bundle/Entity/Role.php b/catalyst/api-bundle/Entity/Role.php deleted file mode 100644 index 89637045..00000000 --- a/catalyst/api-bundle/Entity/Role.php +++ /dev/null @@ -1,28 +0,0 @@ -setAPIKey($this->generateAPIKey()) - ->setSecretKey($this->generateSecretKey()); - - // set date created - $this->date_create = new DateTime(); - $this->metadata = []; - } - - public function getID() - { - return $this->id; - } - - public function setAPIKey($api_key) - { - $this->api_key = $api_key; - return $this; - } - - public function getAPIKey() - { - return $this->api_key; - } - - public function setSecretKey($key) - { - $this->secret_key = $key; - return $this; - } - - public function getSecretKey() - { - return $this->secret_key; - } - - public function setName($name) - { - $this->name = $name; - return $this; - } - - public function getName() - { - return $this->name; - } - - public function getDateCreate() - { - return $this->date_create; - } - - public function getPassword() - { - // we don't need this for API - return 'notneeded'; - } - - public function getSalt() - { - return null; - } - - public function getUsername() - { - // since it's an api, the api key IS the username - return $this->api_key; - } - - public function eraseCredentials() - { - return; - } - - public function generateAPIKey() - { - return $this->generateKey('api'); - } - - public function generateSecretKey() - { - return $this->generateKey('secret'); - } - - public function setMetadata($meta) - { - $this->metadata = $meta; - return $this; - } - - public function getMetadata() - { - if ($this->metadata == null) - return []; - - return $this->metadata; - } - - protected function generateKey($prefix = '') - { - return md5(uniqid($prefix, true)); - } - - public function setRider($rider) - { - $this->rider = $rider; - return $this; - } - - public function getRider() - { - return $this->rider; - } -} - diff --git a/catalyst/api-bundle/Response/APIResponse.php b/catalyst/api-bundle/Response/APIResponse.php deleted file mode 100644 index baa10603..00000000 --- a/catalyst/api-bundle/Response/APIResponse.php +++ /dev/null @@ -1,20 +0,0 @@ - (bool) $success, - 'message' => (string) $message, - 'data' => $data, - ]; - parent::__construct($data, $status, $headers); - } -} - - diff --git a/catalyst/api-bundle/Security/APIKeyAuthenticator.php b/catalyst/api-bundle/Security/APIKeyAuthenticator.php deleted file mode 100644 index 27d1eaf1..00000000 --- a/catalyst/api-bundle/Security/APIKeyAuthenticator.php +++ /dev/null @@ -1,160 +0,0 @@ -em = $em; - } - - protected function validateSignature($creds, $secret_key) - { - $elements = [ - $creds['method'], - $creds['uri'], - $creds['date'], - $secret_key, - ]; - $sig_source = implode('|', $elements); - - error_log($sig_source); - - // generate signature - $raw_sig = hash_hmac('sha1', $sig_source, $secret_key, true); - $enc_sig = base64_encode($raw_sig); - - error_log($enc_sig); - - if ($enc_sig != trim($creds['signature'])) - throw new CustomUserMessageAuthenticationException('Invalid signature.'); - - } - - public function createToken(Request $req, $provider_key) - { - // api key header - $api_key = $req->headers->get(self::HEADER_API_KEY); - if ($api_key == null) - throw new BadCredentialsException('No API key sent.'); - - // check date from headers - $hdate_string = $req->headers->get(self::HEADER_DATE); - if ($hdate_string == null) - throw new BadCredentialsException('No date specified.'); - - $hdate = DateTime::createFromFormat(self::DATE_FORMAT, $hdate_string); - if ($hdate == null) - throw new BadCredentialsException('Invalid date specified.'); - - // get number of seconds difference - $date_now = new DateTime(); - $date_diff = abs($date_now->getTimestamp() - $hdate->getTimestamp()); - - // time difference is too much - if ($date_diff > self::TIME_LIMIT) - throw new BadCredentialsException('Clock synchronization error.'); - - // signature header - $sig = $req->headers->get(self::HEADER_SIGNATURE); - if ($sig == null) - throw new BadCredentialsException('No signature sent.'); - - // credentials - $creds = [ - 'api_key' => $api_key, - 'date' => $hdate_string, - 'signature' => $sig, - 'method' => $req->getRealMethod(), - 'uri' => $req->getPathInfo(), - ]; - - return new PreAuthenticatedToken( - 'anonymous', - $creds, - $provider_key - ); - } - - public function supportsToken(TokenInterface $token, $provider_key) - { - return $token instanceof PreAuthenticatedToken && $token->getProviderKey() === $provider_key; - } - - public function authenticateToken(TokenInterface $token, UserProviderInterface $user_provider, $provider_key) - { - if (!$user_provider instanceof APIKeyUserProvider) - { - throw new \InvalidArgumentException( - sprintf( - 'The user provider must be an instance of APIKeyUserProvider (%s was given).', - get_class($user_provider) - ) - ); - } - - $creds = $token->getCredentials(); - $api_key = $creds['api_key']; - $user = $user_provider->getUserByAPIKey($api_key); - - // check if api key is valid - if (!$user) - throw new CustomUserMessageAuthenticationException('Invalid API Key'); - - // check if signature is valid - $this->validateSignature($creds, $user->getSecretKey()); - - // check if user is enabled - if (!$user->isEnabled()) - { - throw new CustomUserMessageAuthenticationException('User account is disabled'); - } - - // $user = $user_provider->loadUserByUsername($username); - - return new PreAuthenticatedToken( - $user, - $api_key, - $provider_key, - $user->getRoles() - ); - } - - public function onAuthenticationFailure(Request $req, AuthenticationException $exception) - { - $data = [ - 'success' => false, - 'error' => [ - 'message' => $exception->getMessage(), - ], - ]; - return new JsonResponse($data, 401); - } -} diff --git a/catalyst/api-bundle/Security/APIKeyUserProvider.php b/catalyst/api-bundle/Security/APIKeyUserProvider.php deleted file mode 100644 index 742e8d63..00000000 --- a/catalyst/api-bundle/Security/APIKeyUserProvider.php +++ /dev/null @@ -1,62 +0,0 @@ -em = $em; - } - - public function getUserByAPIKey($api_key) - { - $user = $this->em->getRepository(User::class)->findOneBy(array('api_key' => $api_key)); - - return $user; - } - - public function getUsernameForAPIKey($apiKey) - { - // Look up the username based on the token in the database, via - // an API call, or do something entirely different - $username = 'test'; - - return $username; - } - - public function loadUserByUsername($username) - { - return new User( - $username, - null, - // the roles for the user - you may choose to determine - // these dynamically somehow based on the user - array('ROLE_API') - ); - } - - public function refreshUser(UserInterface $user) - { - // this is used for storing authentication in the session - // but in this example, the token is sent in each request, - // so authentication can be stateless. Throwing this exception - // is proper to make things stateless - throw new UnsupportedUserException(); - } - - public function supportsClass($class) - { - return User::class === $class; - } -} diff --git a/catalyst/api-bundle/Service/AccessDeniedHandler.php b/catalyst/api-bundle/Service/AccessDeniedHandler.php deleted file mode 100644 index 7cf5be90..00000000 --- a/catalyst/api-bundle/Service/AccessDeniedHandler.php +++ /dev/null @@ -1,18 +0,0 @@ -getMessage(); - - return new Response($content, 403); - } -} diff --git a/composer.json b/composer.json index 5ade4a34..468f7809 100644 --- a/composer.json +++ b/composer.json @@ -4,18 +4,20 @@ "repositories": [ { "type": "vcs", - "url": "git@gitlab.com:jankstudio-catalyst/auth-bundle.git" + "url": "git@gitlab.com:jankstudio1/catalyst-2/api-bundle.git" }, { "type": "vcs", - "url": "git@gitlab.com:jankstudio-catalyst/menu-bundle.git" + "url": "git@gitlab.com:jankstudio1/catalyst-2/auth-bundle.git" + }, + { + "type": "vcs", + "url": "git@gitlab.com:jankstudio1/catalyst-2/menu-bundle.git" } ], "require": { "php": "^7.1.3", "ext-iconv": "*", - "catalyst/auth-bundle": "dev-master", - "catalyst/menu-bundle": "dev-master", "composer/package-versions-deprecated": "1.11.99.4", "creof/doctrine2-spatial": "^1.2", "data-dog/audit-bundle": "^0.1.10", @@ -25,7 +27,10 @@ "doctrine/orm": "^2", "edwinhoksberg/php-fcm": "^1.0", "guzzlehttp/guzzle": "^6.3", - "hashids/hashids": "^4.1", + "hashids/hashids": "^4.1", + "jankstudio/catalyst-api-bundle": "dev-master", + "jankstudio/catalyst-auth-bundle": "dev-master", + "jankstudio/catalyst-menu-bundle": "dev-master", "microsoft/azure-storage-blob": "^1.5", "predis/predis": "^1.1", "sensio/framework-extra-bundle": "^5.1", @@ -65,8 +70,7 @@ }, "autoload": { "psr-4": { - "App\\": "src/", - "Catalyst\\APIBundle\\": "catalyst/api-bundle/" + "App\\": "src/" } }, "autoload-dev": { diff --git a/composer.lock b/composer.lock index e34b61f9..93fee474 100644 --- a/composer.lock +++ b/composer.lock @@ -4,90 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5b5acb546514b41ab347ef37b85425c9", + "content-hash": "9489b680a355544bdcb0ffa5655418b7", "packages": [ - { - "name": "catalyst/auth-bundle", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://gitlab.com/jankstudio-catalyst/auth-bundle.git", - "reference": "803e38f58907513c8df30c31d51303b68c645a17" - }, - "dist": { - "type": "zip", - "url": "https://gitlab.com/api/v4/projects/jankstudio-catalyst%2Fauth-bundle/repository/archive.zip?sha=803e38f58907513c8df30c31d51303b68c645a17", - "reference": "803e38f58907513c8df30c31d51303b68c645a17", - "shasum": "" - }, - "require": { - "doctrine/dbal": "^2.5.12", - "doctrine/doctrine-cache-bundle": "~1.2", - "php": "^7.0", - "symfony/framework-bundle": "~4.0" - }, - "default-branch": true, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Catalyst\\AuthBundle\\": "" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kendrick Chan", - "email": "kc@jankstudio.com" - } - ], - "support": { - "issues": "https://gitlab.com/api/v4/projects/12709261/issues" - }, - "time": "2019-07-01T09:45:41+00:00" - }, - { - "name": "catalyst/menu-bundle", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://gitlab.com/jankstudio-catalyst/menu-bundle.git", - "reference": "2cf9a05862fcc6f956da4b095962915e07f14f64" - }, - "dist": { - "type": "zip", - "url": "https://gitlab.com/api/v4/projects/jankstudio-catalyst%2Fmenu-bundle/repository/archive.zip?sha=2cf9a05862fcc6f956da4b095962915e07f14f64", - "reference": "2cf9a05862fcc6f956da4b095962915e07f14f64", - "shasum": "" - }, - "require": { - "doctrine/dbal": "^2.5.12", - "doctrine/doctrine-cache-bundle": "~1.2", - "php": "^7.0", - "symfony/framework-bundle": "~4.0" - }, - "default-branch": true, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Catalyst\\MenuBundle\\": "" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kendrick Chan", - "email": "kc@jankstudio.com" - } - ], - "support": { - "issues": "https://gitlab.com/api/v4/projects/12712039/issues" - }, - "time": "2019-06-14T09:43:30+00:00" - }, { "name": "composer/package-versions-deprecated", "version": "1.11.99.4", @@ -1069,102 +987,6 @@ ], "time": "2021-05-06T19:21:22+00:00" }, - { - "name": "doctrine/doctrine-cache-bundle", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/DoctrineCacheBundle.git", - "reference": "6bee2f9b339847e8a984427353670bad4e7bdccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/6bee2f9b339847e8a984427353670bad4e7bdccb", - "reference": "6bee2f9b339847e8a984427353670bad4e7bdccb", - "shasum": "" - }, - "require": { - "doctrine/cache": "^1.4.2", - "doctrine/inflector": "^1.0", - "php": "^7.1", - "symfony/doctrine-bridge": "^3.4|^4.0" - }, - "require-dev": { - "instaclick/coding-standard": "~1.1", - "instaclick/object-calisthenics-sniffs": "dev-master", - "instaclick/symfony2-coding-standard": "dev-remaster", - "phpunit/phpunit": "^7.0", - "predis/predis": "~0.8", - "satooshi/php-coveralls": "^1.0", - "squizlabs/php_codesniffer": "~1.5", - "symfony/console": "^3.4|^4.0", - "symfony/finder": "^3.4|^4.0", - "symfony/framework-bundle": "^3.4|^4.0", - "symfony/phpunit-bridge": "^3.4|^4.0", - "symfony/security-acl": "^2.8", - "symfony/validator": "^3.4|^4.0", - "symfony/yaml": "^3.4|^4.0" - }, - "suggest": { - "symfony/security-acl": "For using this bundle to cache ACLs" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Bundle\\DoctrineCacheBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Fabio B. Silva", - "email": "fabio.bat.silva@gmail.com" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@hotmail.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Doctrine Project", - "homepage": "http://www.doctrine-project.org/" - } - ], - "description": "Symfony Bundle for Doctrine Cache", - "homepage": "https://www.doctrine-project.org", - "keywords": [ - "cache", - "caching" - ], - "support": { - "issues": "https://github.com/doctrine/DoctrineCacheBundle/issues", - "source": "https://github.com/doctrine/DoctrineCacheBundle/tree/1.4.0" - }, - "abandoned": true, - "time": "2019-11-29T11:22:01+00:00" - }, { "name": "doctrine/doctrine-migrations-bundle", "version": "2.2.3", @@ -2480,6 +2302,117 @@ }, "time": "2020-11-26T19:24:33+00:00" }, + { + "name": "jankstudio/catalyst-api-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@gitlab.com:jankstudio1/catalyst-2/api-bundle.git", + "reference": "042d16534265adf81ae67c803b1ae8f0a94f3bb6" + }, + "dist": { + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/jankstudio1%2Fcatalyst-2%2Fapi-bundle/repository/archive.zip?sha=042d16534265adf81ae67c803b1ae8f0a94f3bb6", + "reference": "042d16534265adf81ae67c803b1ae8f0a94f3bb6", + "shasum": "" + }, + "default-branch": true, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Catalyst\\ApiBundle\\": "" + } + }, + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Kendrick Chan", + "email": "kc@jankstudio.com" + } + ], + "support": { + "source": "https://gitlab.com/jankstudio1/catalyst-2/api-bundle/-/tree/master", + "issues": "https://gitlab.com/jankstudio1/catalyst-2/api-bundle/-/issues" + }, + "time": "2022-10-09T14:02:41+08:00" + }, + { + "name": "jankstudio/catalyst-auth-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@gitlab.com:jankstudio1/catalyst-2/auth-bundle.git", + "reference": "50f18ac6d4f6198b7bfe888487e0a4009193403e" + }, + "dist": { + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/jankstudio1%2Fcatalyst-2%2Fauth-bundle/repository/archive.zip?sha=50f18ac6d4f6198b7bfe888487e0a4009193403e", + "reference": "50f18ac6d4f6198b7bfe888487e0a4009193403e", + "shasum": "" + }, + "require": { + "symfony/cache": "^5.0" + }, + "default-branch": true, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Catalyst\\AuthBundle\\": "" + } + }, + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Kendrick Chan", + "email": "kc@jankstudio.com" + } + ], + "support": { + "source": "https://gitlab.com/jankstudio1/catalyst-2/auth-bundle/-/tree/master", + "issues": "https://gitlab.com/jankstudio1/catalyst-2/auth-bundle/-/issues" + }, + "time": "2022-01-19T16:21:57+08:00" + }, + { + "name": "jankstudio/catalyst-menu-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@gitlab.com:jankstudio1/catalyst-2/menu-bundle.git", + "reference": "9cddeecbbbb7d61868e1b319d9abc8eda4f34ab0" + }, + "dist": { + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/jankstudio1%2Fcatalyst-2%2Fmenu-bundle/repository/archive.zip?sha=9cddeecbbbb7d61868e1b319d9abc8eda4f34ab0", + "reference": "9cddeecbbbb7d61868e1b319d9abc8eda4f34ab0", + "shasum": "" + }, + "default-branch": true, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Catalyst\\MenuBundle\\": "" + } + }, + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Kendrick Chan", + "email": "kc@jankstudio.com" + } + ], + "support": { + "source": "https://gitlab.com/jankstudio1/catalyst-2/menu-bundle/-/tree/master", + "issues": "https://gitlab.com/jankstudio1/catalyst-2/menu-bundle/-/issues" + }, + "time": "2022-10-07T11:55:32+08:00" + }, { "name": "laminas/laminas-code", "version": "3.4.1", @@ -8021,8 +7954,9 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "catalyst/auth-bundle": 20, - "catalyst/menu-bundle": 20 + "jankstudio/catalyst-api-bundle": 20, + "jankstudio/catalyst-auth-bundle": 20, + "jankstudio/catalyst-menu-bundle": 20 }, "prefer-stable": false, "prefer-lowest": false, @@ -8031,5 +7965,5 @@ "ext-iconv": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/config/bundles.php b/config/bundles.php index 79841817..cfbe640b 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,7 +2,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], @@ -11,8 +10,8 @@ return [ Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Catalyst\APIBundle\CatalystAPIBundle::class => ['all' => true], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], + Catalyst\ApiBundle\CatalystApiBundle::class => ['all' => true], Catalyst\AuthBundle\CatalystAuthBundle::class => ['all' => true], Catalyst\MenuBundle\CatalystMenuBundle::class => ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], ]; diff --git a/config/cmb.services.yaml b/config/cmb.services.yaml index 5f24e525..5f7feb52 100644 --- a/config/cmb.services.yaml +++ b/config/cmb.services.yaml @@ -42,20 +42,6 @@ services: $cache_dir: "%kernel.cache_dir%" $config_dir: "%kernel.root_dir%/../config" - Catalyst\AuthBundle\Service\ACLGenerator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%app_acl_file%" - - Catalyst\AuthBundle\Service\ACLVoter: - arguments: - $user_class: "App\\Entity\\User" - tags: ['security.voter'] - - Catalyst\AuthBundle\Service\UserChecker: - App\Service\FileUploader: arguments: $target_dir: '%image_upload_directory%' @@ -114,50 +100,6 @@ services: arguments: $redis_client: "@App\\Service\\RedisClientProvider" - Catalyst\APIBundle\Security\APIKeyUserProvider: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Security\APIKeyAuthenticator: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Command\UserCreateCommand: - arguments: - $em: "@doctrine.orm.entity_manager" - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestCommand: - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestAPICommand: - tags: ['console.command'] - - Catalyst\APIBundle\Access\Voter: - arguments: - $acl_gen: "@Catalyst\\APIBundle\\Access\\Generator" - $user_class: "Catalyst\\APIBundle\\Entity\\User" - tags: ['security.voter'] - - Catalyst\APIBundle\Access\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%api_acl_file%" - - Catalyst\MenuBundle\Menu\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - - Catalyst\MenuBundle\Listener\MenuAnnotationListener: - arguments: - $menu_name: "main_menu" - tags: - - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } - # invoice generator App\Service\InvoiceGenerator\CMBInvoiceGenerator: ~ diff --git a/config/packages/catalyst_auth.yaml b/config/packages/catalyst_auth.yaml new file mode 100644 index 00000000..cea91009 --- /dev/null +++ b/config/packages/catalyst_auth.yaml @@ -0,0 +1,616 @@ +catalyst_auth: + main: + user_entity: "Catalyst\\UserBundle\\Entity\\User" + acl_data: + - id: dashboard + label: Dashboard Access + acls: + - id: dashboard.menu + label: Menu + - id: user + label: User Access + acls: + - id: user.menu + label: Menu + - id: user.list + label: List + - id: user.add + label: Add + - id: user.update + label: Update + - id: user.delete + label: Delete + - id: user.role.sadmin + label: Super Admin Role + - id: user.profile + label: User Profile + - id: role + label: Role Access + acls: + - id: role.menu + label: Menu + - id: role.list + label: List + - id: role.add + label: Add + - id: role.update + label: Update + - id: role.delete + label: Delete + - id: apiuser + label: API User Access + acls: + - id: apiuser.menu + label: Menu + - id: apiuser.list + label: List + - id: apiuser.add + label: Add + - id: apiuser.update + label: Update + - id: apiuser.delete + label: Delete + - id: apirole + label: API Role Access + acls: + - id: apirole.menu + label: Menu + - id: apirole.list + label: List + - id: apirole.add + label: Add + - id: apirole.update + label: Update + - id: apirole.delete + label: Delete + - id: logistics + label: Logistics Access + acls: + - id: logistics.menu + label: Menu + - id: battery + label: Battery Access + acls: + - id: battery.menu + label: Menu + - id: battery.list + label: List + - id: battery.add + label: Add + - id: battery.update + label: Update + - id: battery.delete + label: Delete + - id: bmfg + label: Battery Manufacturer Access + acls: + - id: bmfg.menu + label: Menu + - id: bmfg.list + label: List + - id: bmfg.add + label: Add + - id: bmfg.update + label: Update + - id: bmfg.delete + label: Delete + - id: bmodel + label: Battery Model Access + acls: + - id: bmodel.menu + label: Menu + - id: bmodel.list + label: List + - id: bmodel.add + label: Add + - id: bmodel.update + label: Update + - id: bmodel.delete + label: Delete + - id: bsize + label: Battery Size Access + acls: + - id: bsize.menu + label: Menu + - id: bsize.list + label: List + - id: bsize.add + label: Add + - id: bsize.update + label: Update + - id: bsize.delete + label: Delete + - id: vehicle + label: Vehicle Access + acls: + - id: vehicle.menu + label: Menu + - id: vehicle.list + label: List + - id: vehicle.add + label: Add + - id: vehicle.update + label: Update + - id: vehicle.delete + label: Delete + - id: vmfg + label: Vehicle Manufacturer Access + acls: + - id: vmfg.menu + label: Menu + - id: vmfg.list + label: List + - id: vmfg.add + label: Add + - id: vmfg.update + label: Update + - id: vmfg.delete + label: Delete + - id: customer + label: Customer Access + acls: + - id: customer.menu + label: Menu + - id: customer.list + label: List + - id: customer.add + label: Add + - id: customer.update + label: Update + - id: customer.delete + label: Delete + - id: customer.dpa + label: Display DPA + + + - id: location + label: Location Access + acls: + - id: location.menu + label: Menu + - id: outlet + label: Outlet Access + acls: + - id: outlet.menu + label: Menu + - id: outlet.list + label: List + - id: outlet.add + label: Add + - id: outlet.update + label: Update + - id: outlet.delete + label: Delete + - id: hub + label: Hub Access + acls: + - id: hub.menu + label: Menu + - id: hub.list + label: List + - id: hub.add + label: Add + - id: hub.update + label: Update + - id: hub.delete + label: Delete + - id: geofence + label: Geofence + acls: + - id: geofence.menu + label: Menu + - id: geofence.list + label: List + - id: geofence.add + label: Add + - id: geofence.delete + label: Delete + + - id: rider + label: Rider Access + acls: + - id: rider.menu + label: Menu + - id: rider.list + label: List + - id: rider.add + label: Add + - id: rider.update + label: Update + - id: rider.delete + label: Delete + + - id: servicecharge + label: Service Charge + acls: + - id: service_charge.menu + label: Menu + - id: service_charge.list + label: List + - id: service_charge.add + label: Add + - id: service_charge.update + label: Update + - id: service_charge.delete + label: Delete + + - id: joborder + label: Job Order + acls: + - id: joborder.menu + label: Menu + - id: jo_in.list + label: Incoming + - id: jo_proc.list + label: Dispatch + - id: jo_proc.unlock + label: Dispatch Unlock + - id: jo_assign.list + label: Rider Assignment + - id: jo_assign.unlock + label: Rider Assignment Unlock + - id: jo_fulfill.list + label: Fulfillment + - id: jo_open.list + label: Open + - id: jo_all.list + label: View All + - id: jo_pdf.list + label: PDF + - id: jo_open.edit + label: Edit + - id: joborder.cancel + label: Cancel + - id: jo_onestep.form + label: One-step Process + - id: jo_onestep.edit + label: One-step Process Edit + - id: jo_walkin.form + label: Walk-in + - id: jo_walkin.edit + label: Walk-in Edit + - id: jo_autoassign.test + label: Autoassign Test + - id: jo_hub.list + label: Hub View + - id: jo_cancel.fulfill + label: Fulfill Cancelled JO + - id: jo_resq_proc.list + label: RESQ Dispatch + + - id: support + label: Customer Support Access + acls: + - id: support.menu + label: Menu + - id: general.search + label: Search + - id: warranty.search + label: Customer Battery Search + - id: warranty.upload + label: Warranty Upload + + - id: ticket + label: Ticket Access + acls: + - id: ticket.menu + label: Menu + - id: ticket.list + label: List + - id: ticket.add + label: Add + - id: ticket.update + label: Update + - id: ticket.delete + label: Delete + + - id: promo + label: Promo Access + acls: + - id: promo.menu + label: Menu + - id: promo.list + label: List + - id: promo.add + label: Add + - id: promo.update + label: Update + - id: promo.delete + label: Delete + + - id: report + label: Reports + acls: + - id: report.menu + label: Menu + - id: report.reject + label: Rejection Report + - id: report.battery.conflict + label: Battery Conflict Report + - id: report.popapp.comparison + label: Popapp Comparison Report + - id: report.meh.customer + label: RESQ MEH Customer Report + - id: report.warranty.class + label: Warranty Class Report + - id: report.vehicle.battery.compatibility + label: Vehicle Battery Compatibility Report + - id: report.warranty.details + label: Warranty Details Report + - id: report.jo.details + label: Job Order Details Report + - id: report.jo_events + label: Job Order Events Report + - id: report.sms_messages + label: SMS Messages Report + - id: report.jo.auto_assign + label: Auto Assigned Job Order Report + - id: report.jo.advance_order + label: Advance Order Job Order Report + - id: report.customer.source + label: Customer Source Report + - id: report.hub.filter + label: Hub Filter Report + - id: report.warranty.raffle + label: Warranty Raffle Report + - id: report.jo.raffle + label: JO Raffle Report + + - id: service + label: Other Services + acls: + - id: service.menu + label: Menu + - id: service.list + label: List + - id: service.add + label: Add + - id: service.update + label: Update + - id: service.delete + label: Delete + + - id: partner + label: Partners + acls: + - id: partner.menu + label: Menu + - id: partner.list + label: List + - id: partner.add + label: Add + - id: partner.update + label: Update + - id: partner.delete + label: Delete + + - id: review + label: Reviews + acls: + - id: review.menu + label: Menu + - id: review.list + label: List + - id: review.view + label: View + - id: review.delete + label: Delete + + - id: privacypolicy + label: Privacy Policy + acls: + - id: privacy_policy.menu + label: Menu + - id: privacy_policy.list + label: List + - id: privacy_policy.add + label: Add + - id: privacy_policy.update + label: Update + - id: privacy_policy.delete + label: Delete + + - id: warranty + label: Warranty + acls: + - id: warranty.menu + label: Menu + - id: warranty.list + label: List + - id: warranty.add + label: Add + - id: warranty.update + label: Update + + - id: staticcontent + label: Static Content + acls: + - id: static_content.menu + label: Menu + - id: static_content.list + label: List + - id: static_content.add + label: Add + - id: static_content.update + label: Update + - id: static_content.delete + label: Delete + + - id: analytics + label: Analytics + acls: + - id: analytics.menu + label: Menu + - id: analytics.forecast + label: Forecasting + + - id: sap_battery + label: SAP Battery Access + acls: + - id: sap_battery.menu + label: Menu + - id: sap_battery.list + label: List + - id: sap_battery.add + label: Add + - id: sap_battery.update + label: Update + - id: sap_battery.delete + label: Delete + + - id: sap_brand + label: SAP Battery Brand Access + acls: + - id: sap_brand.menu + label: Menu + - id: sap_brand.list + label: List + - id: sap_brand.add + label: Add + - id: sap_brand.update + label: Update + - id: sap_brand.delete + label: Delete + + - id: sap_bsize + label: SAP Battery Size Access + acls: + - id: sap_bsize.menu + label: Menu + - id: sap_bsize.list + label: List + - id: sap_bsize.add + label: Add + - id: sap_bsize.update + label: Update + - id: sap_bsize.delete + label: Delete + + - id: sap_csize + label: SAP Battery Container Size Access + acls: + - id: sap_csize.menu + label: Menu + - id: sap_csize.list + label: List + - id: sap_csize.add + label: Add + - id: sap_csize.update + label: Update + - id: sap_csize.delete + label: Delete + + - id: customer_tag + label: Customer Tags Access + acls: + - id: customer_tag.menu + label: Menu + - id: customer_tag.list + label: List + - id: customer_tag.add + label: Add + - id: customer_tag.update + label: Update + - id: customer_tag.delete + label: Delete + + - id: dealer + label: Dealer Access + acls: + - id: dealer.menu + label: Menu + - id: dealer.list + label: List + - id: dealer.add + label: Add + - id: dealer.update + label: Update + - id: dealer.delete + label: Delete + + - id: database + label: Database Access + acls: + - id: database.menu + label: Menu + + - id: ticket_type + label: Ticket Type Access + acls: + - id: ticket_type.menu + label: Menu + - id: ticket_type.list + label: List + - id: ticket_type.add + label: Add + - id: ticket_type.update + label: Update + - id: ticket_type.delete + label: Delete + + - id: subticket_type + label: Sub Ticket Type Access + acls: + - id: subticket_type.menu + label: Menu + - id: subticket_type.list + label: List + - id: subticket_type.add + label: Add + - id: subticket_type.update + label: Update + - id: subticket_type.delete + label: Delete + + - id: emergency_type + label: Emergency Type Access + acls: + - id: emergency_type.menu + label: Menu + - id: emergency_type.list + label: List + - id: emergency_type.add + label: Add + - id: emergency_type.update + label: Update + - id: emergency_type.delete + label: Delete + + - id: ownership_type + label: Ownership Type Access + acls: + - id: ownership_type.menu + label: Menu + - id: ownership_type.list + label: List + - id: ownership_type.add + label: Add + - id: ownership_type.update + label: Update + - id: ownership_type.delete + label: Delete + + api: + user_entity: "App\\Entity\\ApiUser" + acl_data: + - id: api_test + label: Test + acls: + - id: api.test + label: Test + - id: api_user + label: API User Access + acls: + - id: apiuser.change.password + label: Change User Password + - id: api_battery + label: API Battery Inventory Access + acls: + - id: apibattery.get.info + label: Get Battery Info + - id: api_retailer + label: API Retailer Access + acls: + - id: apiretailer.register + label: Register Retailer + diff --git a/config/packages/catalyst_menu.yaml b/config/packages/catalyst_menu.yaml new file mode 100644 index 00000000..7359a270 --- /dev/null +++ b/config/packages/catalyst_menu.yaml @@ -0,0 +1,268 @@ +catalyst_menu: + main: + - id: home + acl: dashboard.menu + label: '[menu.dashboard]' + icon: flaticon-line-graph + order: 1 + + + - id: user + acl: user.menu + label: '[menu.user]' + icon: flaticon-users + order: 2 + - id: user_list + acl: user.list + label: '[menu.user.users]' + parent: user + - id: role_list + acl: role.list + label: '[menu.user.roles]' + parent: user + + - id: apiuser + acl: apiuser.menu + label: '[menu.apiuser]' + icon: flaticon-users + order: 3 + - id: api_user_list + acl: apiuser.list + label: '[menu.apiuser.users]' + parent: apiuser + - id: api_role_list + acl: apirole.list + label: '[menu.apiuser.roles]' + parent: apiuser + + - id: logistics + acl: logistics.menu + label: '[menu.logistics]' + icon: fa fa-truck + order: 4 + - id: rider_list + acl: rider.list + label: '[menu.logistics.riders]' + parent: logistics + + - id: battery + acl: battery.menu + label: '[menu.battery]' + icon: fa fa-battery-3 + order: 5 + - id: battery_list + acl: battery.list + label: '[menu.battery.batteries]' + parent: battery + - id: bmfg_list + acl: bmfg.list + label: '[menu.battery.manufacturers]' + parent: battery + - id: bmodel_list + acl: bmodel.list + label: '[menu.battery.models]' + parent: battery + - id: bsize_list + acl: bsize.list + label: '[menu.battery.sizes]' + parent: battery + - id: promo_list + acl: promo.list + label: '[menu.battery.promos]' + parent: battery + + - id: sapbattery + acl: sap_battery.menu + label: '[menu.sapbattery]' + icon: fa fa-battery + order: 6 + - id: sapbattery_list + acl: sap_battery.list + label: '[menu.sapbattery.batteries]' + parent: sapbattery + - id: sapbrand_list + acl: sap_brand.list + label: '[menu.sapbattery.brands]' + parent: sapbattery + - id: sapbsize_list + acl: sap_bsize.list + label: '[menu.sapbattery.sizes]' + parent: sapbattery + - id: sapcsize_list + acl: sap_csize.list + label: '[menu.sapbattery.csizes]' + parent: sapbattery + + + - id: vehicle + acl: vehicle.menu + label: '[menu.vehicle]' + icon: fa fa-car + order: 7 + - id: vehicle_list + acl: vehicle.list + label: '[menu.vehicle.vehicles]' + parent: vehicle + - id: vmfg_list + acl: vmfg.list + label: '[menu.vehicle.manufacturers]' + parent: vehicle + + - id: location + acl: location.menu + label: '[menu.location]' + icon: fa fa-home + order: 8 + - id: outlet_list + acl: outlet.menu + label: '[menu.location.outlets]' + parent: location + - id: hub_list + acl: hub.menu + label: '[menu.location.hubs]' + parent: location + - id: dealer_list + acl: dealer.list + label: '[menu.location.dealers]' + parent: location + - id: geofence_list + acl: geofence.menu + label: '[menu.location.geofence]' + parent: location + + + - id: joborder + acl: joborder.menu + label: '[menu.joborder]' + icon: flaticon-calendar-3 + order: 9 + - id: jo_in + acl: jo_in.list + label: '[menu.joborder.incoming]' + parent: joborder + - id: jo_proc + acl: jo_proc.list + label: '[menu.joborder.dispatch]' + parent: joborder + - id: jo_resq_proc + acl: jo_resq_proc.list + label: '[menu.joborder.resqdispatch]' + parent: joborder + - id: jo_assign + acl: jo_assign.list + label: '[menu.joborder.assignment]' + parent: joborder + - id: jo_fulfill + acl: jo_fulfill.list + label: '[menu.joborder.fulfillment]' + parent: joborder + - id: jo_open + acl: jo_open.list + label: '[menu.joborder.open]' + parent: joborder + - id: jo_all + acl: jo_all.list + label: '[menu.joborder.viewall]' + parent: joborder + - id: jo_hub_view + acl: jo_hub.list + label: '[menu.joborder.hubview]' + parent: joborder + + - id: support + acl: support.menu + label: '[menu.support]' + icon: flaticon-support + order: 10 + - id: customer_list + acl: customer.list + label: '[menu.support.customers]' + parent: support + - id: ticket_list + acl: ticket.list + label: '[menu.support.tickets]' + parent: support + - id: general_search + acl: general.search + label: '[menu.support.searxch]' + parent: support + - id: warranty_search + acl: warranty.search + label: '[menu.support.warrantysearch]' + parent: support + - id: privacy_policy_list + acl: privacy_policy.list + label: '[menu.support.privacypolicy]' + parent: support + - id: warranty_list + acl: warranty.list + label: '[menu.support.warranty]' + parent: support + - id: warranty_upload + acl: warranty.upload + label: '[menu.support.warrantyupload]' + parent: support + - id: static_content_list + acl: static_content.list + label: '[menu.support.staticcontent]' + parent: support + - id: customertag_list + acl: customer_tag.list + label: '[menu.support.customertags]' + parent: support + + - id: service + acl: service.menu + label: '[menu.service]' + icon: flaticon-squares + order: 11 + - id: service_list + acl: service.list + label: '[menu.service.services]' + parent: service + + - id: partner + acl: partner.menu + label: '[menu.partner]' + icon: flaticon-network + order: 12 + - id: partner_list + acl: partner.list + label: '[menu.partner.partners]' + parent: partner + - id: review_list + acl: review.list + label: '[menu.partner.reviews]' + parent: partner + + - id: analytics + acl: analytics.menu + label: '[menu.analytics]' + icon: flaticon-graphic + order: 13 + - id: analytics_forecast_form + acl: analytics.forecast + label: '[menu.analytics.forecasting]' + parent: analytics + + - id: database + acl: database.menu + label: '[menu.database]' + icon: fa fa-database + order: 14 + - id: ticket_type_list + acl: ticket_type.menu + label: '[menu.database.tickettypes]' + parent: database + - id: subticket_type_list + acl: subticket_type.menu + label: '[menu.database.subtickettypes]' + parent: database + - id: emergency_type_list + acl: emergency_type.menu + label: '[menu.database.emergencytypes]' + parent: database + - id: ownership_type_list + acl: ownership_type.menu + label: '[menu.database.ownershiptypes]' + parent: database \ No newline at end of file diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 1b0f6824..79a7ae0a 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -9,8 +9,10 @@ security: entity: class: App\Entity\User property: username - api_key_user_provider: - id: Catalyst\APIBundle\Security\APIKeyUserProvider + api_provider: + entity: + class: Catalyst\UserBundle\Entity\User + property: api_key firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ @@ -49,27 +51,30 @@ security: warranty_api: pattern: ^\/capi\/ + provider: api_provider + access_denied_handler: Catalyst\ApiBundle\Service\AccessDeniedHandler stateless: true - simple_preauth: - authenticator: Catalyst\APIBundle\Security\APIKeyAuthenticator - provider: api_key_user_provider - user_checker: Catalyst\AuthBundle\Service\UserChecker + guard: + authenticators: + - Catalyst\ApiBundle\Security\Authenticator new_rider_api: pattern: ^\/rider_api\/ + provider: api_provider + access_denied_handler: Catalyst\ApiBundle\Service\AccessDeniedHandler stateless: true - simple_preauth: - authenticator: Catalyst\APIBundle\Security\APIKeyAuthenticator - provider: api_key_user_provider - user_checker: Catalyst\AuthBundle\Service\UserChecker + guard: + authenticators: + - Catalyst\ApiBundle\Security\Authenticator third_party_api: pattern: ^\/tapi\/ + provider: api_provider + access_denied_handler: Catalyst\ApiBundle\Service\AccessDeniedHandler stateless: true - simple_preauth: - authenticator: Catalyst\APIBundle\Security\APIKeyAuthenticator - provider: api_key_user_provider - user_checker: Catalyst\AuthBundle\Service\UserChecker + guard: + authenticators: + - Catalyst\ApiBundle\Security\Authenticator main: provider: user_provider diff --git a/config/resq.services.yaml b/config/resq.services.yaml index 82eb4cc5..177d68b5 100644 --- a/config/resq.services.yaml +++ b/config/resq.services.yaml @@ -43,20 +43,6 @@ services: $cache_dir: "%kernel.cache_dir%" $config_dir: "%kernel.root_dir%/../config" - Catalyst\AuthBundle\Service\ACLGenerator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%app_acl_file%" - - Catalyst\AuthBundle\Service\ACLVoter: - arguments: - $user_class: "App\\Entity\\User" - tags: ['security.voter'] - - Catalyst\AuthBundle\Service\UserChecker: - App\Service\FileUploader: arguments: $target_dir: '%image_upload_directory%' @@ -115,50 +101,6 @@ services: arguments: $redis_client: "@App\\Service\\RedisClientProvider" - Catalyst\APIBundle\Security\APIKeyUserProvider: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Security\APIKeyAuthenticator: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Command\UserCreateCommand: - arguments: - $em: "@doctrine.orm.entity_manager" - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestCommand: - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestAPICommand: - tags: ['console.command'] - - Catalyst\APIBundle\Access\Voter: - arguments: - $acl_gen: "@Catalyst\\APIBundle\\Access\\Generator" - $user_class: "Catalyst\\APIBundle\\Entity\\User" - tags: ['security.voter'] - - Catalyst\APIBundle\Access\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%api_acl_file%" - - Catalyst\MenuBundle\Menu\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - - Catalyst\MenuBundle\Listener\MenuAnnotationListener: - arguments: - $menu_name: "main_menu" - tags: - - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } - # invoice generator App\Service\InvoiceGenerator\ResqInvoiceGenerator: ~ diff --git a/config/services.yaml b/config/services.yaml index a5d7d05f..d7cd73b2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -43,20 +43,6 @@ services: $cache_dir: "%kernel.cache_dir%" $config_dir: "%kernel.root_dir%/../config" - Catalyst\AuthBundle\Service\ACLGenerator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%app_acl_file%" - - Catalyst\AuthBundle\Service\ACLVoter: - arguments: - $user_class: "App\\Entity\\User" - tags: ['security.voter'] - - Catalyst\AuthBundle\Service\UserChecker: - App\Service\FileUploader: arguments: $target_dir: '%image_upload_directory%' @@ -120,50 +106,6 @@ services: arguments: $redis_client: "@App\\Service\\RedisClientProvider" - Catalyst\APIBundle\Security\APIKeyUserProvider: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Security\APIKeyAuthenticator: - arguments: - $em: "@doctrine.orm.entity_manager" - - Catalyst\APIBundle\Command\UserCreateCommand: - arguments: - $em: "@doctrine.orm.entity_manager" - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestCommand: - tags: ['console.command'] - - Catalyst\APIBundle\Command\TestAPICommand: - tags: ['console.command'] - - Catalyst\APIBundle\Access\Voter: - arguments: - $acl_gen: "@Catalyst\\APIBundle\\Access\\Generator" - $user_class: "Catalyst\\APIBundle\\Entity\\User" - tags: ['security.voter'] - - Catalyst\APIBundle\Access\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - $acl_file: "%api_acl_file%" - - Catalyst\MenuBundle\Menu\Generator: - arguments: - $router: "@router.default" - $cache_dir: "%kernel.cache_dir%" - $config_dir: "%kernel.root_dir%/../config" - - Catalyst\MenuBundle\Listener\MenuAnnotationListener: - arguments: - $menu_name: "main_menu" - tags: - - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } - # invoice generator App\Service\InvoiceGenerator\ResqInvoiceGenerator: ~ diff --git a/src/Command/CreateRiderAPIUserCommand.php b/src/Command/CreateRiderAPIUserCommand.php index 96508fd8..bec98a72 100644 --- a/src/Command/CreateRiderAPIUserCommand.php +++ b/src/Command/CreateRiderAPIUserCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Entity\User as APIUser; -use Catalyst\APIBundle\Entity\Role as APIRole; +use Catalyst\ApiBundle\Entity\User as APIUser; +use Catalyst\ApiBundle\Entity\Role as APIRole; use App\Entity\Rider; diff --git a/src/Controller/APIRoleController.php b/src/Controller/APIRoleController.php index f347d890..4c60b4cd 100644 --- a/src/Controller/APIRoleController.php +++ b/src/Controller/APIRoleController.php @@ -2,8 +2,8 @@ namespace App\Controller; -use Catalyst\APIBundle\Entity\Role as APIRole; -use Catalyst\APIBundle\Access\Generator as APIACLGenerator; +use Catalyst\ApiBundle\Entity\Role as APIRole; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -19,7 +19,7 @@ class APIRoleController extends Controller { protected $api_acl_gen; - public function __construct(APIACLGenerator $api_acl_gen) + public function __construct(ACLGenerator $api_acl_gen) { $this->api_acl_gen = $api_acl_gen; } diff --git a/src/Controller/APIUserController.php b/src/Controller/APIUserController.php index 122d3830..2c11b56f 100644 --- a/src/Controller/APIUserController.php +++ b/src/Controller/APIUserController.php @@ -2,8 +2,8 @@ namespace App\Controller; -use Catalyst\APIBundle\Entity\User as APIUser; -use Catalyst\APIBundle\Entity\Role as APIRole; +use Catalyst\ApiBundle\Entity\User as APIUser; +use Catalyst\ApiBundle\Entity\Role as APIRole; use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Controller/CAPI/BatteryController.php b/src/Controller/CAPI/BatteryController.php index 5a03c379..b61d39b8 100644 --- a/src/Controller/CAPI/BatteryController.php +++ b/src/Controller/CAPI/BatteryController.php @@ -6,14 +6,14 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\SAPBattery; use App\Entity\SAPBatterySize; use App\Entity\SAPBatteryBrand; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class BatteryController extends APIController { diff --git a/src/Controller/CAPI/CustomerController.php b/src/Controller/CAPI/CustomerController.php index 912e0235..629cb0e9 100644 --- a/src/Controller/CAPI/CustomerController.php +++ b/src/Controller/CAPI/CustomerController.php @@ -8,8 +8,8 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Customer; use App\Entity\CustomerVehicle; @@ -17,7 +17,7 @@ use App\Entity\Vehicle; use App\Service\HashGenerator; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class CustomerController extends APIController { diff --git a/src/Controller/CAPI/CustomerWarrantyController.php b/src/Controller/CAPI/CustomerWarrantyController.php index c5562d40..4482bbd1 100644 --- a/src/Controller/CAPI/CustomerWarrantyController.php +++ b/src/Controller/CAPI/CustomerWarrantyController.php @@ -10,8 +10,8 @@ use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Service\RisingTideGateway; use App\Service\WarrantyAPILogger; @@ -37,7 +37,7 @@ use App\Ramcar\WarrantySource; use DateTime; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; // third party API class CustomerWarrantyController extends APIController diff --git a/src/Controller/CAPI/DealerController.php b/src/Controller/CAPI/DealerController.php index c59e4a54..798898a4 100644 --- a/src/Controller/CAPI/DealerController.php +++ b/src/Controller/CAPI/DealerController.php @@ -6,12 +6,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Dealer; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class DealerController extends APIController { diff --git a/src/Controller/CAPI/MunicipalityController.php b/src/Controller/CAPI/MunicipalityController.php index 8345cd45..6ad82ebf 100644 --- a/src/Controller/CAPI/MunicipalityController.php +++ b/src/Controller/CAPI/MunicipalityController.php @@ -6,12 +6,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Municipality; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class MunicipalityController extends APIController { diff --git a/src/Controller/CAPI/PrivacyPolicyController.php b/src/Controller/CAPI/PrivacyPolicyController.php index 034d12ff..80d8e167 100644 --- a/src/Controller/CAPI/PrivacyPolicyController.php +++ b/src/Controller/CAPI/PrivacyPolicyController.php @@ -7,12 +7,12 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\PrivacyPolicy; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; // third party API class PrivacyPolicyController extends APIController diff --git a/src/Controller/CAPI/RiderAppController.php b/src/Controller/CAPI/RiderAppController.php index 1a293058..1f749e96 100644 --- a/src/Controller/CAPI/RiderAppController.php +++ b/src/Controller/CAPI/RiderAppController.php @@ -11,8 +11,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Rider; use App\Entity\JOEvent; @@ -22,7 +22,7 @@ use App\Entity\BatteryModel; use App\Entity\BatterySize; use App\Entity\RiderAPISession; use App\Entity\User; -use Catalyst\APIBundle\Entity\User as APIUser; +use Catalyst\ApiBundle\Entity\User as APIUser; use App\Service\RedisClientProvider; use App\Service\RiderCache; diff --git a/src/Controller/CAPI/TestController.php b/src/Controller/CAPI/TestController.php index 9604c056..0db0754b 100644 --- a/src/Controller/CAPI/TestController.php +++ b/src/Controller/CAPI/TestController.php @@ -5,8 +5,8 @@ namespace App\Controller\CAPI; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; class TestController extends APIController { diff --git a/src/Controller/CAPI/VehicleController.php b/src/Controller/CAPI/VehicleController.php index 1f3b13b4..e0aec499 100644 --- a/src/Controller/CAPI/VehicleController.php +++ b/src/Controller/CAPI/VehicleController.php @@ -6,12 +6,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Vehicle; use App\Entity\VehicleManufacturer; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class VehicleController extends APIController { diff --git a/src/Controller/CAPI/WarrantyController.php b/src/Controller/CAPI/WarrantyController.php index 3d9ab97b..63fe972b 100644 --- a/src/Controller/CAPI/WarrantyController.php +++ b/src/Controller/CAPI/WarrantyController.php @@ -7,8 +7,8 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Warranty; use App\Entity\BatteryModel; @@ -33,7 +33,7 @@ use App\Ramcar\WarrantySource; use DateTime; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; // third party API class WarrantyController extends APIController diff --git a/src/Controller/CAPI/WarrantySerialController.php b/src/Controller/CAPI/WarrantySerialController.php index c845e367..675eabc7 100644 --- a/src/Controller/CAPI/WarrantySerialController.php +++ b/src/Controller/CAPI/WarrantySerialController.php @@ -10,8 +10,8 @@ use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\WarrantySerialQueue; @@ -19,7 +19,7 @@ use App\Service\WarrantySerialUploadLogger; use DateTime; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; // third party API class WarrantySerialController extends APIController diff --git a/src/Controller/RiderController.php b/src/Controller/RiderController.php index c53ac626..069fb1a8 100644 --- a/src/Controller/RiderController.php +++ b/src/Controller/RiderController.php @@ -25,8 +25,8 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Catalyst\MenuBundle\Annotation\Menu; -use Catalyst\APIBundle\Entity\User as APIUser; -use Catalyst\APIBundle\Entity\Role as APIRole; +use Catalyst\ApiBundle\Entity\User as APIUser; +use Catalyst\ApiBundle\Entity\Role as APIRole; use DateTime; diff --git a/src/Controller/TAPI/BatteryController.php b/src/Controller/TAPI/BatteryController.php index 7e015fe6..85c866d6 100644 --- a/src/Controller/TAPI/BatteryController.php +++ b/src/Controller/TAPI/BatteryController.php @@ -8,13 +8,13 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Ramcar\APIResult; use App\Entity\Vehicle; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class BatteryController extends APIController { diff --git a/src/Controller/TAPI/JobOrderController.php b/src/Controller/TAPI/JobOrderController.php index e70928f8..6f67ca30 100644 --- a/src/Controller/TAPI/JobOrderController.php +++ b/src/Controller/TAPI/JobOrderController.php @@ -11,8 +11,8 @@ use Doctrine\ORM\EntityManagerInterface; use CrEOF\Spatial\PHP\Types\Geometry\Point; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Ramcar\WarrantyClass; use App\Ramcar\JOStatus; @@ -59,7 +59,7 @@ use App\Entity\Warranty; use DateTime; use DateInterval; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class JobOrderController extends APIController { diff --git a/src/Controller/TAPI/PromoController.php b/src/Controller/TAPI/PromoController.php index 90cbaf0a..9961b7ec 100644 --- a/src/Controller/TAPI/PromoController.php +++ b/src/Controller/TAPI/PromoController.php @@ -8,12 +8,12 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Promo; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class PromoController extends APIController { diff --git a/src/Controller/TAPI/ServiceController.php b/src/Controller/TAPI/ServiceController.php index 5f468cd8..3cf3f8da 100644 --- a/src/Controller/TAPI/ServiceController.php +++ b/src/Controller/TAPI/ServiceController.php @@ -8,12 +8,12 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\Service; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class ServiceController extends APIController { diff --git a/src/Controller/TAPI/VehicleController.php b/src/Controller/TAPI/VehicleController.php index 5e8bf122..d1ed822f 100644 --- a/src/Controller/TAPI/VehicleController.php +++ b/src/Controller/TAPI/VehicleController.php @@ -8,13 +8,13 @@ use Symfony\Component\HttpFoundation\Request; use Doctrine\ORM\Query; use Doctrine\ORM\EntityManagerInterface; -use Catalyst\APIBundle\Controller\APIController; -use Catalyst\APIBundle\Response\APIResponse; +use Catalyst\ApiBundle\Controller\ApiController; +use Catalyst\ApiBundle\Response\APIResponse; use App\Entity\VehicleManufacturer; use App\Entity\Vehicle; -use Catalyst\APIBundle\Access\Generator as ACLGenerator; +use Catalyst\AuthBundle\Service\ACLGenerator as ACLGenerator; class VehicleController extends APIController { diff --git a/src/Entity/Rider.php b/src/Entity/Rider.php index 020393da..201ede0d 100644 --- a/src/Entity/Rider.php +++ b/src/Entity/Rider.php @@ -9,7 +9,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Criteria; use App\Ramcar\JOStatus; -use Catalyst\APIBundle\Entity\User as APIUser; +use Catalyst\ApiBundle\Entity\User as APIUser; /** * @ORM\Entity @@ -131,7 +131,7 @@ class Rider protected $current_job_order; /** - * @ORM\OneToOne(targetEntity="Catalyst\APIBundle\Entity\User", inversedBy="rider") + * @ORM\OneToOne(targetEntity="Catalyst\ApiBundle\Entity\User", inversedBy="rider") * @ORM\JoinColumn(name="api_user_id", referencedColumnName="id", nullable=true) */ protected $api_user; diff --git a/symfony.lock b/symfony.lock index 6a96a3a8..1853ec79 100644 --- a/symfony.lock +++ b/symfony.lock @@ -1,10 +1,4 @@ { - "catalyst/auth-bundle": { - "version": "dev-master" - }, - "catalyst/menu-bundle": { - "version": "dev-master" - }, "creof/doctrine2-spatial": { "version": "1.2.0" }, @@ -53,9 +47,6 @@ "ref": "44d3aa7752dd46f77ba11af2297a25e1dedfb4d0" } }, - "doctrine/doctrine-cache-bundle": { - "version": "1.3.2" - }, "doctrine/doctrine-fixtures-bundle": { "version": "3.0", "recipe": { @@ -113,6 +104,15 @@ "hashids/hashids": { "version": "4.1.0" }, + "jankstudio/catalyst-api-bundle": { + "version": "dev-master" + }, + "jankstudio/catalyst-auth-bundle": { + "version": "dev-master" + }, + "jankstudio/catalyst-menu-bundle": { + "version": "dev-master" + }, "jdorn/sql-formatter": { "version": "v1.2.17" }, diff --git a/templates/base.html.twig b/templates/base.html.twig index 50e72b20..d679555b 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -770,7 +770,8 @@
- {{ menu.main_menu(main_menu.menu) }} + {% set main_menu = menu_get('main') %} + {{ menu.main_menu(main_menu) }}
diff --git a/templates/menu.html.twig b/templates/menu.html.twig index 4f200a7d..1d0a27d0 100644 --- a/templates/menu.html.twig +++ b/templates/menu.html.twig @@ -2,36 +2,38 @@ {% import _self as menu %} {% endmacro %} @@ -47,7 +49,7 @@ {% else %}