Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GuardScope to operate within container scopes #1146

Merged
merged 2 commits into from
Sep 11, 2024
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
4 changes: 3 additions & 1 deletion src/Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
],
"require": {
"php": ">=8.1",
"psr/container": "^1.1|^2.0"
"psr/container": "^1.1|^2.0",
"spiral/core": "^3.14",
"spiral/security": "^3.14"
},
"require-dev": {
"mockery/mockery": "^1.5",
Expand Down
4 changes: 3 additions & 1 deletion src/Framework/Security/GuardScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@

use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Spiral\Core\Attribute\Proxy;
use Spiral\Core\Exception\ScopeException;
use Spiral\Security\Exception\GuardException;

/**
* Resolves Actor dynamically, using current active IoC scope.
* @deprecated Use {@see GuardInterface} instead. Will be removed in v4.0.
*/
final class GuardScope implements GuardInterface
{
private ?ActorInterface $actor = null;

public function __construct(
private readonly PermissionsInterface $permissions,
private readonly ContainerInterface $container,
#[Proxy] private readonly ContainerInterface $container,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, this works.

private array $roles = []
) {
}
Expand Down
Loading