Skip to content

Commit c0c851c

Browse files
authored
PS-907 fix rendition and attribute definitions forms (#621)
1 parent a755408 commit c0c851c

File tree

19 files changed

+3836
-3876
lines changed

19 files changed

+3836
-3876
lines changed

databox/api/fixtures/Newspaper.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,14 @@ App\Entity\Integration\WorkspaceIntegration:
505505
title: ToastUI
506506
integration: tui.photo-editor
507507
workspace: '@w_newspaper'
508+
ownerId: <keycloakUser("phrasea-admin", ["phrasea-admin"])>
508509
wi_renditions:
509510
integration: core.rendition
510511
workspace: '@w_newspaper'
512+
ownerId: <keycloakUser("phrasea-admin", ["phrasea-admin"])>
511513
wi_watermark:
512514
integration: core.watermark
515+
ownerId: <keycloakUser("phrasea-admin", ["phrasea-admin"])>
513516
workspace: '@w_newspaper'
514517
config:
515518
attributeName: watermark
@@ -518,13 +521,15 @@ App\Entity\Integration\WorkspaceIntegration:
518521
needs:
519522
- '@wi_renditions'
520523
wi_blurhash:
524+
ownerId: <keycloakUser("phrasea-admin", ["phrasea-admin"])>
521525
integration: blurhash
522526
workspace: '@w_newspaper'
523527
config:
524528
rendition: thumbnail
525529
needs:
526530
- '@wi_renditions'
527531
wi_expose:
532+
ownerId: <keycloakUser("phrasea-admin", ["phrasea-admin"])>
528533
title: Expose Basket
529534
integration: phrasea.expose
530535
config:

databox/api/src/Api/Model/Output/AttributeDefinitionOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AttributeDefinitionOutput extends AbstractUuidOutput
4848
#[Groups([AttributeDefinition::GROUP_LIST])]
4949
public ?string $fileType = null;
5050

51-
#[Groups([AttributeDefinition::GROUP_LIST, Asset::GROUP_LIST, Share::GROUP_PUBLIC_READ])]
51+
#[Groups([AttributeDefinition::GROUP_LIST, Asset::GROUP_LIST, Asset::GROUP_READ, Share::GROUP_PUBLIC_READ])]
5252
public string $fieldType = TextAttributeType::NAME;
5353

5454
#[Groups([AttributeDefinition::GROUP_LIST])]

databox/api/src/Entity/Core/AttributeDefinition.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
shortName: 'attribute-definition',
4444
operations: [
4545
new Get(
46-
security: 'is_granted("'.AbstractVoter::READ.'", object)'
46+
security: 'is_granted("'.AbstractVoter::READ.'", object)',
4747
),
4848
new Delete(security: 'is_granted("DELETE", object)'),
4949
new Put(
50-
normalizationContext: [
51-
'groups' => [self::GROUP_READ],
52-
],
5350
security: 'is_granted("'.AbstractVoter::EDIT.'", object)'
5451
),
5552
new Patch(security: 'is_granted("'.AbstractVoter::EDIT.'", object)'),
5653
new GetCollection(
54+
normalizationContext: [
55+
'groups' => [AttributeDefinition::GROUP_LIST],
56+
],
5757
parameters: [
5858
'searchable' => new QueryParameter(
5959
schema: ['type' => 'boolean'],
@@ -62,12 +62,9 @@
6262
'workspaceId' => new QueryParameter(
6363
schema: ['type' => 'string'],
6464
),
65-
]
65+
],
6666
),
6767
new Post(
68-
normalizationContext: [
69-
'groups' => [self::GROUP_READ],
70-
],
7168
security: 'is_granted("'.JwtUser::IS_AUTHENTICATED_FULLY.'")',
7269
securityPostDenormalize: 'is_granted("CREATE", object)',
7370
),
@@ -96,7 +93,7 @@
9693
),
9794
],
9895
normalizationContext: [
99-
'groups' => [AttributeDefinition::GROUP_LIST],
96+
'groups' => [AttributeDefinition::GROUP_LIST, AttributeDefinition::GROUP_READ],
10097
],
10198
input: AttributeDefinitionInput::class,
10299
output: AttributeDefinitionOutput::class,

databox/api/src/Entity/Core/RenditionPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class RenditionPolicy extends AbstractUuidEntity implements \Stringable
6363
#[Assert\NotNull]
6464
protected ?Workspace $workspace = null;
6565

66-
#[Groups([RenditionPolicy::GROUP_LIST, RenditionPolicy::GROUP_READ])]
66+
#[Groups([RenditionPolicy::GROUP_LIST, RenditionPolicy::GROUP_READ, RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ])]
6767
#[ORM\Column(type: Types::STRING, length: 80)]
6868
#[Assert\NotNull]
6969
private ?string $name = null;

databox/client/src/components/Dialog/Workspace/AttributeDefinitionManager.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,12 @@ export default function AttributeDefinitionManager({
443443
function normalizeData(data: AttributeDefinition) {
444444
return {
445445
...data,
446-
policy: data.policy ? (data.policy as AttributePolicy)['@id'] : null,
446+
policy:
447+
typeof data.policy === 'string'
448+
? data.policy
449+
: data.policy
450+
? (data.policy as AttributePolicy)['@id']
451+
: null,
447452
entityList: data.entityList
448453
? (data.entityList as EntityList)['@id']
449454
: null,

databox/client/src/components/Dialog/Workspace/RenditionDefinitionManager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function normalizeData(data: RenditionDefinition) {
262262
return {
263263
...data,
264264
buildMode: data.buildMode?.toString(),
265-
class:
265+
policy:
266266
typeof data.policy === 'string'
267267
? data.policy
268268
: data.policy

0 commit comments

Comments
 (0)