mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed problem that no datastructures with an parent element could be created/edited via API
This fixes issue #512. The error was introduced when trying to allow the modification of attachments/parameters throught the parent element. We need a seperate write scope to the element, or we end up with an infinite loop.
This commit is contained in:
parent
fea8109789
commit
3cc1fb40f0
2 changed files with 4 additions and 4 deletions
|
@ -77,7 +77,7 @@ use LogicException;
|
||||||
new Delete(security: 'is_granted("delete", object)'),
|
new Delete(security: 'is_granted("delete", object)'),
|
||||||
],
|
],
|
||||||
normalizationContext: ['groups' => ['attachment:read', 'attachment:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
normalizationContext: ['groups' => ['attachment:read', 'attachment:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||||
denormalizationContext: ['groups' => ['attachment:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
denormalizationContext: ['groups' => ['attachment:write', 'attachment:write:standalone', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||||
)]
|
)]
|
||||||
#[DocumentedAPIProperty(schemaName: 'Attachment-Read', property: 'media_url', type: 'string', nullable: true,
|
#[DocumentedAPIProperty(schemaName: 'Attachment-Read', property: 'media_url', type: 'string', nullable: true,
|
||||||
description: 'The URL to the file, where the attachment file can be downloaded. This can be an internal or external URL.',
|
description: 'The URL to the file, where the attachment file can be downloaded. This can be an internal or external URL.',
|
||||||
|
@ -142,7 +142,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
* ORM mapping is done in subclasses (like PartAttachment).
|
* ORM mapping is done in subclasses (like PartAttachment).
|
||||||
* @phpstan-param T|null $element
|
* @phpstan-param T|null $element
|
||||||
*/
|
*/
|
||||||
#[Groups(['attachment:read:standalone', 'attachment:write'])]
|
#[Groups(['attachment:read:standalone', 'attachment:write:standalone'])]
|
||||||
protected ?AttachmentContainingDBElement $element = null;
|
protected ?AttachmentContainingDBElement $element = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::BOOLEAN)]
|
#[ORM\Column(type: Types::BOOLEAN)]
|
||||||
|
|
|
@ -87,7 +87,7 @@ use function sprintf;
|
||||||
new Delete(security: 'is_granted("delete", object)'),
|
new Delete(security: 'is_granted("delete", object)'),
|
||||||
],
|
],
|
||||||
normalizationContext: ['groups' => ['parameter:read', 'parameter:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
normalizationContext: ['groups' => ['parameter:read', 'parameter:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||||
denormalizationContext: ['groups' => ['parameter:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
denormalizationContext: ['groups' => ['parameter:write', 'parameter:write:standalone', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
|
||||||
)]
|
)]
|
||||||
#[ApiFilter(LikeFilter::class, properties: ["name", "symbol", "unit", "group", "value_text"])]
|
#[ApiFilter(LikeFilter::class, properties: ["name", "symbol", "unit", "group", "value_text"])]
|
||||||
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
|
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
|
||||||
|
@ -161,7 +161,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
*
|
*
|
||||||
* @var AbstractDBElement|null the element to which this parameter belongs to
|
* @var AbstractDBElement|null the element to which this parameter belongs to
|
||||||
*/
|
*/
|
||||||
#[Groups(['parameter:read:standalone', 'parameter:write'])]
|
#[Groups(['parameter:read:standalone', 'parameter:write:standalone'])]
|
||||||
protected ?AbstractDBElement $element = null;
|
protected ?AbstractDBElement $element = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue