mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 14:04:30 +02:00
Fixed coding style.
This commit is contained in:
parent
24939f2342
commit
fd61c8d9e2
129 changed files with 962 additions and 1091 deletions
|
@ -198,9 +198,9 @@ class ElementPermissionListener
|
|||
* Checks if access to the property of the given element is granted.
|
||||
* This function adds an additional cache layer, where the voters are called only once (to improve performance).
|
||||
*
|
||||
* @param string $mode What operation should be checked. Must be 'read' or 'edit'
|
||||
* @param ColumnSecurity $annotation The annotation of the property that should be checked
|
||||
* @param AbstractDBElement $element The element that should for which should be checked
|
||||
* @param string $mode What operation should be checked. Must be 'read' or 'edit'
|
||||
* @param ColumnSecurity $annotation The annotation of the property that should be checked
|
||||
* @param AbstractDBElement $element The element that should for which should be checked
|
||||
*
|
||||
* @return bool True if the user is allowed to read that property
|
||||
*/
|
||||
|
|
|
@ -53,7 +53,7 @@ class AttachmentVoter extends ExtendedVoter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
|
|
|
@ -91,7 +91,7 @@ abstract class ExtendedVoter extends Voter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
|
||||
|
|
|
@ -52,7 +52,7 @@ class GroupVoter extends ExtendedVoter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,8 +23,6 @@
|
|||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
|
@ -30,9 +31,6 @@ class OrderdetailVoter extends ExtendedVoter
|
|||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
|
@ -42,9 +40,6 @@ class OrderdetailVoter extends ExtendedVoter
|
|||
return $this->resolver->inherit($user, 'parts_orderdetails', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, Orderdetail::class, true)) {
|
||||
|
@ -56,4 +51,4 @@ class OrderdetailVoter extends ExtendedVoter
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,7 +23,6 @@
|
|||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
|
@ -29,9 +31,6 @@ class PartLotVoter extends ExtendedVoter
|
|||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
|
@ -41,9 +40,6 @@ class PartLotVoter extends ExtendedVoter
|
|||
return $this->resolver->inherit($user, 'parts_lots', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, PartLot::class, true)) {
|
||||
|
@ -55,4 +51,4 @@ class PartLotVoter extends ExtendedVoter
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,5 @@ class PartVoter extends ExtendedVoter
|
|||
|
||||
//Null concealing operator means, that no
|
||||
return $this->resolver->inherit($user, 'parts', $attribute) ?? false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ class PermissionVoter extends ExtendedVoter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,8 +23,6 @@
|
|||
|
||||
namespace App\Security\Voter;
|
||||
|
||||
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
||||
|
@ -30,9 +31,6 @@ class PricedetailVoter extends ExtendedVoter
|
|||
/** @var string[] When this permsission are encountered, they are checked on part */
|
||||
protected const PART_PERMS = ['show_history', 'revert_element'];
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if (in_array($attribute, self::PART_PERMS, true)) {
|
||||
|
@ -42,9 +40,6 @@ class PricedetailVoter extends ExtendedVoter
|
|||
return $this->resolver->inherit($user, 'parts_prices', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if (is_a($subject, Pricedetail::class, true)) {
|
||||
|
@ -56,4 +51,4 @@ class PricedetailVoter extends ExtendedVoter
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,11 @@ declare(strict_types=1);
|
|||
namespace App\Security\Voter;
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
|
@ -87,7 +85,7 @@ class StructureVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function instanceToPermissionName($subject): ?string
|
||||
{
|
||||
if (!is_string($subject)) {
|
||||
if (! is_string($subject)) {
|
||||
$class_name = get_class($subject);
|
||||
} else {
|
||||
$class_name = $subject;
|
||||
|
@ -121,7 +119,7 @@ class StructureVoter extends ExtendedVoter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
|
|
|
@ -73,7 +73,7 @@ class UserVoter extends ExtendedVoter
|
|||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue