Initial commit: CloudOps infrastructure platform

This commit is contained in:
root
2026-04-09 19:58:57 +02:00
commit 1166a52f26
7762 changed files with 839452 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Mautic\ApiBundle\Security\Voter;
use Mautic\CoreBundle\Security\Permissions\CorePermissions;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\User\UserInterface;
class ApiPermissionVoter extends Voter
{
public function __construct(private CorePermissions $security)
{
}
protected function supports(string $attribute, mixed $subject): bool
{
// Support Mautic permission format like 'focus:items:viewown'
return str_contains($attribute, ':');
}
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
{
$user = $token->getUser();
if (!$user instanceof UserInterface) {
return false;
}
// Use Mautic's security system to check permissions
return $this->security->isGranted($attribute);
}
}