Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dot-rbac-guard

Defines authorization guards that authorize users for accessing certain parts of an application based on various criteria.
Defines authorization guards that authorize users to access certain parts of an application based on various criteria.
If the authorization service can be used to check authorization on a narrow level, the guards are meant to work as gateways to bigger parts of an application.
Usually, you'll want to use both methods in an application for increased security.

Expand All @@ -11,7 +11,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-rbac-guard/.
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-rbac-guard)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.1.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.2.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/network)
Expand All @@ -36,7 +36,7 @@ You'll have to first configure dot-rbac before using this module.

## Configuration

As with many Dotkernel modules, we focus on the configuration based approach of customizing the module for your needs.
As with many Dotkernel modules, we focus on the configuration-based approach of customizing the module for your needs.

After installing, merge the module's `ConfigProvider` with your application's config to make sure required dependencies and default module configuration are registered.
Create a configuration file for this module in your 'config/autoload' folder.
Expand All @@ -63,8 +63,8 @@ return [
//register custom guards providers here
'guards_provider_manager' => [],

//define which guards provider to use, along with its configuration
//the guards provider should know how to build a list of GuardInterfaces based on its configuration
//define which guard provider to use, along with its configuration
//the guard provider should know how to build a list of GuardInterfaces based on its configuration
'guards_provider' => [
'type' => 'ArrayGuards',
'options' => [
Expand Down Expand Up @@ -97,9 +97,11 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'roles' => [//list of roles to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of roles to allow
'roles' => [],
],
]
]
Expand All @@ -110,16 +112,20 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'permissions' => [//list of permissions to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of permissions to allow
'permissions' => [],
],
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//list of actions to apply, or empty array for all actions
'actions' => [],
'permissions' => [
//permission can be defined in this way too, for all permission type guards
'permissions' => [//list of permissions],
//list of permissions
'permissions' => [],
'condition' => \Dot\Rbac\Guard\GuardInterface::CONDITION_OR,
]
]
Expand All @@ -143,7 +149,7 @@ return [

## Register the RbacGuardMiddleware in the pipe

The last step in order to use this package is to register the middleware.
The last step to use this package is to register the middleware.
This middleware triggers the authorization event.
You MUST insert this middleware between the routing middleware and the dispatch middleware of the application, because the guards need the `RouteResult` in order to get the matched route and params.

Expand Down
8 changes: 3 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|----------------------------------------------------------------------------------------------------------------|
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.0.0) |
| 3.x | :x: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/3.4.3) |
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.2.0) |
| 3.x | :x: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/3.7.0) |
| <= 2.x | :x: | |


## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in this project,
Expand All @@ -25,7 +23,7 @@ When reporting issues, please provide the following information:
We request that you contact us via the email address above and give the
project contributors a chance to resolve the vulnerability and issue a new
release prior to any public exposure; this helps protect the project's
users, and provides them with a chance to upgrade and/or update in order to
users and provides them with a chance to upgrade and/or update to
protect their applications.


Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"dotkernel/dot-authentication": "^2.3.4",
"dotkernel/dot-controller": "^4.0",
"dotkernel/dot-rbac": "^4.0",
Expand Down Expand Up @@ -62,7 +62,7 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"static-analysis": "phpstan analyse --memory-limit 1G"
"static-analysis": "phpstan analyse --memory-limit 1G",
"test": "phpunit --colors=always"
}
}
28 changes: 17 additions & 11 deletions docs/book/v3/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

As with many Dotkernel modules, we focus on the configuration based approach of customizing the module for your needs.
As with many Dotkernel modules, we focus on the configuration-based approach of customizing the module for your needs.

After installing, merge the module's `ConfigProvider` with your application's config to make sure required dependencies and default module configuration are registered.
Create a configuration file for this module in your 'config/autoload' folder.
Expand All @@ -27,8 +27,8 @@ return [
//register custom guards providers here
'guards_provider_manager' => [],

//define which guards provider to use, along with its configuration
//the guards provider should know how to build a list of GuardInterfaces based on its configuration
//define which guard provider to use, along with its configuration
//the guard provider should know how to build a list of GuardInterfaces based on its configuration
'guards_provider' => [
'type' => 'ArrayGuards',
'options' => [
Expand Down Expand Up @@ -61,9 +61,11 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'roles' => [//list of roles to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of roles to allow
'roles' => [],
],
]
]
Expand All @@ -74,16 +76,20 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'permissions' => [//list of permissions to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of permissions to allow
'permissions' => [],
],
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//list of actions to apply, or empty array for all actions
'actions' => [],
'permissions' => [
//permission can be defined in this way too, for all permission type guards
'permissions' => [//list of permissions],
//list of permissions
'permissions' => [],
'condition' => \Dot\Rbac\Guard\GuardInterface::CONDITION_OR,
]
]
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v3/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The rbac authorization guards service authorizes users for accessing certain par
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-rbac-guard)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/3.7.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/network)
Expand Down
28 changes: 17 additions & 11 deletions docs/book/v4/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

As with many Dotkernel modules, we focus on the configuration based approach of customizing the module for your needs.
As with many Dotkernel modules, we focus on the configuration-based approach of customizing the module for your needs.

After installing, merge the module's `ConfigProvider` with your application's config to make sure required dependencies and default module configuration are registered.
Create a configuration file for this module in your 'config/autoload' folder.
Expand All @@ -27,8 +27,8 @@ return [
//register custom guards providers here
'guards_provider_manager' => [],

//define which guards provider to use, along with its configuration
//the guards provider should know how to build a list of GuardInterfaces based on its configuration
//define which guard provider to use, along with its configuration
//the guard provider should know how to build a list of GuardInterfaces based on its configuration
'guards_provider' => [
'type' => 'ArrayGuards',
'options' => [
Expand Down Expand Up @@ -61,9 +61,11 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'roles' => [//list of roles to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of roles to allow
'roles' => [],
],
]
]
Expand All @@ -74,16 +76,20 @@ return [
'rules' => [
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//by default, authorization pass if all permissions are present(AND)
'permissions' => [//list of permissions to allow],
//list of actions to apply, or empty array for all actions
'actions' => [],
//by default, authorization pass if all permissions are present (AND)
//list of permissions to allow
'permissions' => [],
],
[
'route' => 'controller route name',
'actions' => [//list of actions to apply, or empty array for all actions],
//list of actions to apply, or empty array for all actions
'actions' => [],
'permissions' => [
//permission can be defined in this way too, for all permission type guards
'permissions' => [//list of permissions],
//list of permissions
'permissions' => [],
'condition' => \Dot\Rbac\Guard\GuardInterface::CONDITION_OR,
]
]
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v4/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The rbac authorization guards service authorizes users for accessing certain par
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-rbac-guard)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.1.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac-guard/4.2.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-rbac-guard)](https://github.com/dotkernel/dot-rbac-guard/network)
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v4/updating-pipeline.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Register the RbacGuardMiddleware in the pipeline

The last step in order to use this package is to register the middleware.
The last step to use this package is to register the middleware.
This middleware triggers the authorization event.
You MUST insert this middleware between the routing middleware and the dispatch middleware of the application, because the guards need the `RouteResult` in order to get the matched route and params.

Expand Down