robsontenorio / laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel
MIT License
434 stars 141 forks source link

Add hasAnyRole function to validate multiple roles for a given resource #88

Closed luizjr closed 1 year ago

luizjr commented 1 year ago

In this commit, a new function called hasAnyRole was added to check if a user possesses any of the specified roles for a given resource. This function accepts a resource and an array of roles as input parameters and returns true if the user has at least one of the roles, or false otherwise. The implementation builds on the existing hasRole function, iterating through the array of roles to perform the necessary validation.

robsontenorio commented 1 year ago

@luizjr Could you please add some test and provide a minimal docs for README.? Thanks!

codecov[bot] commented 1 year ago

Codecov Report

Merging #88 (b8b3275) into master (ade40e3) will not change coverage. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##              master       #88   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        32        37    +5     
===========================================
  Files              4         4           
  Lines             88        97    +9     
===========================================
+ Hits              88        97    +9     
Impacted Files Coverage Δ
src/KeycloakGuard.php 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

luizjr commented 1 year ago

@robsontenorio Do I need to do anything else to unlock this new functionality?