login consent app sql
This commit is contained in:
31
vendor/symfony/security-core/Role/Role.php
vendored
Normal file
31
vendor/symfony/security-core/Role/Role.php
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Role;
|
||||
|
||||
/**
|
||||
* Allows migrating session payloads from v4.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class Role
|
||||
{
|
||||
private $role;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
}
|
81
vendor/symfony/security-core/Role/RoleHierarchy.php
vendored
Normal file
81
vendor/symfony/security-core/Role/RoleHierarchy.php
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Role;
|
||||
|
||||
/**
|
||||
* RoleHierarchy defines a role hierarchy.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class RoleHierarchy implements RoleHierarchyInterface
|
||||
{
|
||||
private $hierarchy;
|
||||
/** @var array<string, list<string>> */
|
||||
protected $map;
|
||||
|
||||
/**
|
||||
* @param array<string, list<string>> $hierarchy
|
||||
*/
|
||||
public function __construct(array $hierarchy)
|
||||
{
|
||||
$this->hierarchy = $hierarchy;
|
||||
|
||||
$this->buildRoleMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReachableRoleNames(array $roles): array
|
||||
{
|
||||
$reachableRoles = $roles;
|
||||
|
||||
foreach ($roles as $role) {
|
||||
if (!isset($this->map[$role])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($this->map[$role] as $r) {
|
||||
$reachableRoles[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
return array_values(array_unique($reachableRoles));
|
||||
}
|
||||
|
||||
protected function buildRoleMap()
|
||||
{
|
||||
$this->map = [];
|
||||
foreach ($this->hierarchy as $main => $roles) {
|
||||
$this->map[$main] = $roles;
|
||||
$visited = [];
|
||||
$additionalRoles = $roles;
|
||||
while ($role = array_shift($additionalRoles)) {
|
||||
if (!isset($this->hierarchy[$role])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$visited[] = $role;
|
||||
|
||||
foreach ($this->hierarchy[$role] as $roleToAdd) {
|
||||
$this->map[$main][] = $roleToAdd;
|
||||
}
|
||||
|
||||
foreach (array_diff($this->hierarchy[$role], $visited) as $additionalRole) {
|
||||
$additionalRoles[] = $additionalRole;
|
||||
}
|
||||
}
|
||||
|
||||
$this->map[$main] = array_unique($this->map[$main]);
|
||||
}
|
||||
}
|
||||
}
|
27
vendor/symfony/security-core/Role/RoleHierarchyInterface.php
vendored
Normal file
27
vendor/symfony/security-core/Role/RoleHierarchyInterface.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Role;
|
||||
|
||||
/**
|
||||
* RoleHierarchyInterface is the interface for a role hierarchy.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface RoleHierarchyInterface
|
||||
{
|
||||
/**
|
||||
* @param string[] $roles
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getReachableRoleNames(array $roles): array;
|
||||
}
|
23
vendor/symfony/security-core/Role/SwitchUserRole.php
vendored
Normal file
23
vendor/symfony/security-core/Role/SwitchUserRole.php
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Core\Role;
|
||||
|
||||
/**
|
||||
* Allows migrating session payloads from v4.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class SwitchUserRole extends Role
|
||||
{
|
||||
private $deprecationTriggered;
|
||||
private $source;
|
||||
}
|
Reference in New Issue
Block a user