mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-16 13:24:31 +02:00
Check for permissions before showing user infos or allow the user to change its own infos.
This commit is contained in:
parent
b9cd2fcc7f
commit
6ed2eeabae
5 changed files with 130 additions and 10 deletions
|
@ -35,8 +35,6 @@ namespace App\Services;
|
|||
use App\Configuration\PermissionsConfiguration;
|
||||
use App\Entity\User;
|
||||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
@ -70,6 +68,8 @@ class PermissionResolver
|
|||
);
|
||||
|
||||
$this->permission_structure = $processedConfiguration;
|
||||
|
||||
//dump($this->permission_structure);
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,5 +163,18 @@ class PermissionResolver
|
|||
return isset($this->permission_structure['perms'][$permission]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the permission operation combination with the given names is existing.
|
||||
*
|
||||
* @param string $permission The name of the permission which should be checked.
|
||||
* @param string $operation The name of the operation which should be checked.
|
||||
* @return bool True if the given permission operation combination is existing.
|
||||
*/
|
||||
public function isValidOperation(string $permission, string $operation) : bool
|
||||
{
|
||||
return $this->isValidPermission($permission) &&
|
||||
isset($this->permission_structure['perms'][$permission]['operations'][$operation]);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue