Download the PHP package tourze/biz-role-bundle without Composer
On this page you can find all versions of the php package tourze/biz-role-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package biz-role-bundle
BizRoleBundle
中文
A Symfony bundle for managing business roles and permissions with entity-level access control.
Table of Contents
- Requirements
- Installation
- Features
- Configuration
- Usage
- Advanced Usage
- Security Considerations
- Events
- Testing
- License
Requirements
- PHP 8.1+
- Symfony 7.3+
- Doctrine ORM 3.0+
- EasyAdmin Bundle 4.0+
- Additional Tourze packages (automatically installed)
Installation
Enable the bundle in your config/bundles.php:
Features
- Role Management: Create and manage business roles with hierarchical inheritance
- Permission System: Flexible permission assignment with inclusion/exclusion capabilities
- Entity-Level Access Control: Define data permissions based on entity classes with custom WHERE clauses
- Admin Integration: EasyAdmin controllers for role and permission management
- Security Integration: Implements Symfony Security interfaces for seamless integration
- Audit Trail: Built-in tracking for changes with user, timestamp, and IP logging
Configuration
Entity Mapping
The bundle provides two main entities:
- BizRole - Represents a system role
- RoleEntityPermission - Defines entity-level data permissions
Database Schema
Run migrations to create the required tables:
This creates two tables:
biz_role- Stores role definitions with hierarchical supportbiz_data_permission- Stores entity-level permissions with custom WHERE clauses
Usage
Creating Roles
Entity-Level Permissions
Define data access rules for specific entities:
Admin Interface
The bundle provides EasyAdmin controllers:
- BizRoleCrudController - Manage roles
- RoleEntityPermissionCrudController - Manage entity permissions
Register them in your EasyAdmin dashboard:
Permission Checking
Roles can be assigned to users and checked using Symfony Security:
Features
Role Properties
- name: Unique role identifier (e.g., ROLE_ADMIN)
- title: Human-readable role name
- permissions: Array of permission strings
- excludePermissions: Permissions to explicitly deny
- hierarchicalRoles: Parent roles to inherit from
- admin: Boolean flag for system administrators
- menuJson: Custom menu configuration
- valid: Enable/disable the role
Entity Permission Properties
- entityClass: Fully qualified class name
- statement: SQL WHERE clause for filtering
- remark: Description of the permission
- valid: Enable/disable the permission
Tracking Features
All entities include:
- Creation and update timestamps
- User tracking (created by, updated by)
- IP address tracking
Events
The bundle integrates with Doctrine events for tracking changes. All modifications are automatically logged with user and timestamp information.
Advanced Usage
Role Hierarchy
Roles can inherit permissions from other roles:
Complex Entity Permissions
Use parameterized queries for dynamic filtering:
Custom Permission Checks
Implement custom permission logic in your security voters:
Security Considerations
- SQL Injection: Entity permission statements should be parameterized
- Role Validation: Ensure roles are validated before assignment
- Permission Caching: Consider caching permission checks for performance
- Audit Trail: All changes are tracked for security auditing
Testing
Run the test suite:
Code Coverage
Generate test coverage report:
License
This bundle is available under the MIT License. See the LICENSE file for details.
All versions of biz-role-bundle with dependencies
doctrine/data-fixtures Version ^2.0
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/doctrine-fixtures-bundle Version ^4.0
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
nesbot/carbon Version ^2.72 || ^3
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/security-core Version ^7.3
symfony/serializer Version ^7.3
symfony/yaml Version ^7.3
tourze/arrayable Version 1.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-ip-bundle Version 1.1.*
tourze/doctrine-resolve-target-entity-bundle Version 1.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/doctrine-track-bundle Version 1.1.*
tourze/doctrine-user-bundle Version 1.0.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/rbac-core Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/user-attribute-bundle Version 1.0.*
tourze/user-service-contracts Version 1.1.*