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-5817: Exposed UserService::getUserContentTypeIdentifiers public API #238

Closed
wants to merge 2 commits into from

Conversation

alongosz
Copy link
Member

@alongosz alongosz commented May 23, 2023

Question Answer
JIRA issue IBX-5817
Required by https://github.com/ibexa/corporate-account/pull/194
Type feature
Target Ibexa version v4.6
BC breaks no, consumer API changes

This PR exposes pre-existing private UserService::getUserContentTypeIdentifiers as public API. It could be helpful when implementing IBX-5817 to build proper query from within the package. The package should have no knowledge which configuration setting returns that information. Exposing dedicated API was quick and made more sense.

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly.
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ibexa/engineering).

@sonarcloud
Copy link

sonarcloud bot commented May 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alongosz alongosz requested review from Nattfarinn, ViniTou and a team May 23, 2023 17:36
@DominikaK DominikaK added the Doc needed The changes require some documentation label May 24, 2023
@konradoboza konradoboza requested a review from a team May 24, 2023 06:09
@adamwojs
Copy link
Member

It could be helpful when implementing IBX-5817 to build proper query from within the package.

Do you mean https://github.com/ibexa/corporate-account/pull/194/files#diff-09cd466416031ac3f84d4d7df59c6813967655d54790af059f5dd7fa0bc55fe8R52 ?

If yes, then there is already dedicated criterion for this use case: \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsUserBased

Copy link
Member

@adamwojs adamwojs left a comment

Choose a reason for hiding this comment

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

@alongosz
Copy link
Member Author

It could be helpful when implementing IBX-5817 to build proper query from within the package.

Do you mean https://github.com/ibexa/corporate-account/pull/194/files#diff-09cd466416031ac3f84d4d7df59c6813967655d54790af059f5dd7fa0bc55fe8R52 ?

If yes, then there is already dedicated criterion for this use case: \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\IsUserBased

@adamwojs IsUserBased Criterion doesn't do exactly the same thing. It performs a sub-select checking if content id exists in ezuser table. It's not the same as: "give me content items which are of the currently configured user content types". By default it leads to the same thing, but it might give different results if Integrator changes that configuration of User Content Types. The implementation in https://github.com/ibexa/corporate-account/pull/194 was based on \Ibexa\Core\Repository\UserService::loadUsersOfUserGroup which uses CriterionContentTypeIdentifier.

It's also worth to notice that

WHERE content_type.identifier IN ('user')

is more performant than

WHERE c.id IN (SELECT contentobject_id FROM ezuser)

We can of course decide that for the purpose of https://github.com/ibexa/corporate-account/pull/194 we should use IsUserBased, but given the above, I wouldn't.

This PR itself without extra context should give value. Additionally we could introduce IsUserContentType Criterion, but that requires more work.

@alongosz alongosz requested a review from adamwojs May 24, 2023 13:33
@alongosz
Copy link
Member Author

After a bit of discussion within PHP Team, we've decided not to expose content type related information further in UserService, at least for now. I'll update https://github.com/ibexa/corporate-account/pull/194 to use IsUserBased, as requested.

@alongosz alongosz closed this May 30, 2023
@alongosz alongosz deleted the ibx-5817-expose-user-ct-list-api branch May 30, 2023 09:45
@dabrt dabrt removed the Doc needed The changes require some documentation label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants