Skip to content

Releases: squareetlabs/LaravelSimplePermissions

v1.0.2

18 Dec 12:49

Choose a tag to compare

v1.0.1

13 Dec 22:05

Choose a tag to compare

Full Changelog: V1.0.0...v1.0.1

feat: Initial release of Laravel Simple Permissions package

05 Dec 16:39

Choose a tag to compare

Features

Ability helper methods

  • Add allowAbility(), forbidAbility(), and removeAbility() methods to HasPermissions trait
  • Simplify ability management for specific entities
  • Improve hasAbility() method to check global permissions before specific abilities

Event system

  • Implement events: RoleAssigned, RoleRemoved, AbilityGranted, AbilityRevoked
  • Allow custom hooks for permission changes
  • Document event system in README

Performance optimization

  • Implement eager loading in allPermissions(), hasRole(), and hasAbility()
  • Reduce N+1 queries in permission checks
  • Improve overall package performance

Automatic validation

  • Add automatic validation of permission codes in Permission model
  • Update ValidPermission rule to support wildcards (posts.*, *)
  • Validate permission format before saving

Improved error handling

  • Improve error handling in ability middleware
  • Add entity validation and appropriate HTTP responses (404, 500)
  • Improve error messages

Tests

  • Fix skipped tests in AbilityMiddlewareTest
  • Add tests for ability helper methods (3 tests)
  • Add tests for permission events (4 tests)
  • Total: 38 tests passing

Documentation

  • Complete README with helper methods and usage examples
  • Add events section with examples
  • Document environment variables (SIMPLE_PERMISSIONS_*)
  • Add CONTRIBUTING.md

Package Structure

Core Components

  • Role-Based Access Control (RBAC) system
  • Permission management with wildcard support
  • Entity-specific abilities
  • Group management
  • Caching system for performance
  • Audit logging (optional)
  • Event system for permission changes

Laravel Integration

  • Middleware for route protection
  • Blade directives for views
  • Policy generation command
  • Artisan commands for management

Final status

  • ✅ 38 tests passing
  • ✅ No linting errors
  • ✅ No PHP syntax errors
  • ✅ Optimized and documented code
  • ✅ Ready for production