Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-7935: Handled User-related structs in FieldCollectionType dispatcher #64

Merged
merged 17 commits into from
Jun 17, 2024

Conversation

barw4
Copy link
Contributor

@barw4 barw4 commented Mar 14, 2024

Question Answer
JIRA issue IBX-7935
Type bug
Target version v4.6
BC breaks no
Doc needed no

The FieldPermissionChecker (https://github.com/ibexa/permissions/blob/4.5/src/lib/EventSubscriber/FieldPermissionCheckSubscriber.php#L46-L47) doesn't account for User-related structs like UserCreateStruct or UserUpdateStruct, therefore those fields won't be disabled in case one is editing user content.

The following PR creates some necessary events and dispatches them accordingly in the FieldCollectionType class :https://github.com/ibexa/content-forms/blob/main/src/lib/Form/Type/Content/FieldCollectionType.php.

Related PR: https://github.com/ibexa/permissions/pull/17

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Asked for a review (ping @ibexa/engineering).

@barw4 barw4 added the Bug Something isn't working label Mar 14, 2024
@barw4 barw4 self-assigned this Mar 14, 2024
@barw4 barw4 marked this pull request as ready for review March 15, 2024 10:57
@barw4 barw4 requested a review from a team March 15, 2024 10:57
@barw4 barw4 force-pushed the ibx-7935-user-structs-FieldCollectionType branch from 9272b28 to aa1e6f9 Compare April 3, 2024 15:35
@barw4 barw4 changed the base branch from 4.5 to 4.6 April 3, 2024 15:36
Copy link

sonarcloud bot commented Apr 3, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

src/bundle/Controller/UserController.php Outdated Show resolved Hide resolved
src/lib/Event/StructFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/StructFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/StructFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserCreateFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserUpdateFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserUpdateFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Form/Type/Content/FieldCollectionType.php Outdated Show resolved Hide resolved
src/lib/Form/Type/Content/FieldCollectionType.php Outdated Show resolved Hide resolved
@konradoboza konradoboza requested a review from a team April 16, 2024 07:26
@barw4 barw4 requested a review from Steveb-p May 10, 2024 10:40
@barw4 barw4 requested review from Steveb-p, konradoboza and a team May 13, 2024 12:22
src/bundle/Controller/UserController.php Outdated Show resolved Hide resolved
src/lib/Event/StructFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/StructFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserCreateFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserUpdateFieldOptionsEvent.php Outdated Show resolved Hide resolved
src/lib/Event/UserUpdateFieldOptionsEvent.php Outdated Show resolved Hide resolved
@konradoboza konradoboza requested a review from a team May 13, 2024 12:27
@barw4 barw4 requested a review from konradoboza May 13, 2024 12:35
@barw4 barw4 requested a review from a team May 13, 2024 12:48
@konradoboza konradoboza requested a review from a team May 13, 2024 12:50
@barw4
Copy link
Contributor Author

barw4 commented May 13, 2024

@Steveb-p @konradoboza if you have some spare time please see https://github.com/ibexa/permissions/pull/17 as it's a part of the solution

@micszo micszo self-assigned this May 24, 2024
Copy link
Contributor

@micszo micszo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "register" scenario is this repo and in regression tests create product and create company scenarios are failing with this type of exception:

An error has occurred resolving the options of the form "Ibexa\User\Form\Type\UserRegisterType": The option "struct" with value null is expected to be of type "Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct" or "Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct" or "Ibexa\Contracts\Core\Repository\Values\User\UserCreateStruct" or "Ibexa\Contracts\Core\Repository\Values\User\UserUpdateStruct", but is of type "null".

@barw4 barw4 requested a review from micszo May 28, 2024 10:24
@micszo
Copy link
Contributor

micszo commented May 28, 2024

Current status:

register OK
create company OK
edit company NOK
create product NOK

Copy link

sonarcloud bot commented May 29, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@micszo micszo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Approved on Ibexa Commerce 4.6.7-dev (diff ok).

@micszo micszo removed their assignment May 29, 2024
@Nattfarinn Nattfarinn merged commit 04dd868 into 4.6 Jun 17, 2024
14 checks passed
@Nattfarinn Nattfarinn deleted the ibx-7935-user-structs-FieldCollectionType branch June 17, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working QA approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants