mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Fixed PHPstan issues
This commit is contained in:
parent
2554120e6e
commit
df11f62a2f
5 changed files with 11 additions and 4 deletions
|
@ -108,8 +108,12 @@ class UsersPermissionsCommand extends Command
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
break; //Show the new table
|
break; //Show the new table
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (isset($op_to_edit, $perm_to_edit)) {
|
||||||
$this->permissionResolver->setPermission($user, $perm_to_edit, $op_to_edit, $new_value);
|
$this->permissionResolver->setPermission($user, $perm_to_edit, $op_to_edit, $new_value);
|
||||||
|
} else {
|
||||||
|
throw new \RuntimeException('Erorr while editing permission');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ensure that all operations are set accordingly
|
//Ensure that all operations are set accordingly
|
||||||
|
|
|
@ -145,6 +145,8 @@ class TreeController extends AbstractController
|
||||||
{
|
{
|
||||||
if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) {
|
if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) {
|
||||||
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root');
|
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root');
|
||||||
|
} else {
|
||||||
|
return new JsonResponse("Access denied", 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
|
|
|
@ -91,6 +91,8 @@ class AttachmentVoter extends ExtendedVoter
|
||||||
case 'show_private':
|
case 'show_private':
|
||||||
return $this->resolver->inherit($user, 'attachments', 'show_private') ?? false;
|
return $this->resolver->inherit($user, 'attachments', 'show_private') ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new \RuntimeException('Encountered unknown attribute "'.$attribute.'" in AttachmentVoter!');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@ use App\Entity\Parameters\SupplierParameter;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Services\UserSystem\PermissionManager;
|
use App\Services\UserSystem\PermissionManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit\TextUI\RuntimeException;
|
use RuntimeException;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
class ParameterVoter extends ExtendedVoter
|
class ParameterVoter extends ExtendedVoter
|
||||||
|
|
|
@ -25,9 +25,8 @@ class PermissionPresetsHelper
|
||||||
* Apply the given preset to the permission holding entity (like a user)
|
* Apply the given preset to the permission holding entity (like a user)
|
||||||
* The permission data will be reset during the process and then the preset will be applied.
|
* The permission data will be reset during the process and then the preset will be applied.
|
||||||
*
|
*
|
||||||
* @param
|
|
||||||
* @param string $preset_name The name of the preset to use
|
* @param string $preset_name The name of the preset to use
|
||||||
* @return PermissionData
|
* @return HasPermissionsInterface
|
||||||
*/
|
*/
|
||||||
public function applyPreset(HasPermissionsInterface $perm_holder, string $preset_name): HasPermissionsInterface
|
public function applyPreset(HasPermissionsInterface $perm_holder, string $preset_name): HasPermissionsInterface
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue