artox-lab / clarc-bundle
Build Symfony project within Clean Architecture
Installs: 25 847
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 5
Open Issues: 8
Type:symfony-bundle
Requires
- php: >=7.4 || ^8.0
- ext-json: *
- doctrine/annotations: ^1.12
- google/protobuf: ^3.3
- league/fractal: ^0.20
- liip/monitor-bundle: ^2.16
- pagerfanta/pagerfanta: ^3.0
- symfony-bundles/json-request-bundle: ^4.0
- symfony/framework-bundle: ^5.2
- symfony/messenger: ^5.2
- symfony/translation: ^5.2
- symfony/validator: ^5.2
Requires (Dev)
- haydenpierce/class-finder: ^0.4.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-master
- symfony/maker-bundle: ^1.29
- 5.2.x-dev
- v5.2.17
- v5.2.16
- v5.2.15
- v5.2.14
- v5.2.13
- v5.2.12
- v5.2.12-beta.4
- v5.2.12-beta.3
- v5.2.12-beta.2
- v5.2.12-beta.1
- v5.2.11
- 5.2.10
- v5.2.9
- v5.2.8
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.1.1
- v5.1.0
- v5.0.3
- v5.0.2
- v5.0.1
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- 1.x-dev
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
- v0.3.3
- v0.3.2
- 0.3.1
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- 0.2.2
- 0.2.1
- v0.1.12
- 0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1
- dev-RND-500
- dev-fix/resourse_keys
This package is auto-updated.
Last update: 2024-10-29 09:08:02 UTC
README
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require artox-lab/clarc-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require artox-lab/clarc-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php return [ // ... ArtoxLab\Bundle\ClarcBundle\ArtoxLabClarcBundle::class => ['all' => true], ];
Step 3: Configuration
Configure bundle
# config/packages/artox_lab_clarc.yaml artox_lab_clarc: api: serializer: class: \ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Transformers\Serializers\NullObjectArraySerializer security: rbac: permissions: ROLE_MAINTAINER: - show
Security
How to setup get authenticated user permissions
API endpoint
- Add to your project routes file
config/routes.yaml
artox_lab_clarc_bundle_user_permissions: path: /v1/user/permissions controller: ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Controllers\PermissionController::permissions methods: GET
- Setup firewall and access control in
config/packages/security.yaml
security: firewalls: users: pattern: ^/v1 ... access_control: - { path: ^/v1/, roles: IS_AUTHENTICATED_FULLY }
Note: If you have more than one authenticator - do the setup for each one
How to use RBAC
- Setup roles and permissions in config
config/packages/artox_lab_clarc.yaml
- Require
ArtoxLab\Bundle\ClarcBundle\Core\Entity\Security\AuthorizationChecker
in your use case / controller - Check user permission
$this->authorizationChecker->isGranted('permission_name')
Navigation
- Setup config
# config/packages/artox_lab_clarc.yaml artox_lab_clarc: navigation: left_menu: show_orphaned_root: false items: - icon: portfolio title: Управление компаниями children: - icon: something link: /companies title: Компании permissions: company.list - link: /companies/add title: Добавить компанию permissions: [company.create]
- Add routes
# config/routes.yaml artox_lab_admin_user_navigations: path: /user/navigations controller: ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Controllers\NavigationController::userNavigation methods: GET
- Secure routes
# config/packages/security.yaml security: firewalls: main: pattern: ^/user ... access_control: - { path: ^/user, roles: IS_AUTHENTICATED_FULLY}
- Call API
GET /user/navigations
with authentication