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

FindMedia query #3822

Closed
rflorent opened this issue Mar 5, 2018 · 2 comments
Closed

FindMedia query #3822

rflorent opened this issue Mar 5, 2018 · 2 comments
Assignees
Labels
Bug Error or unexpected behavior of already existing functionality
Milestone

Comments

@rflorent
Copy link

rflorent commented Mar 5, 2018

Q A
Bug? maybe
New Feature? no
Sulu Version 1.6.12
Browser Version Firefox

Actual Behavior

When using the findeMedia method of the media repository, there an automatic filter on ids.
It will query media ids and use them to filter the main query, if ids is not set or null.
https://github.com/sulu/sulu/blob/develop/src/Sulu/Bundle/MediaBundle/Entity/MediaRepository.php#L151

This getIds query don't apply the collection access control and will return ids regardless from permission.
For example, have 2 collections, one with no user permissions, one with a user view permission.
I want to get a paginated list of ten medias available, the getIds query will return ten media ids of the 'no permission' collection, and will be used as filter by the findMedia query.
FindMedia query will apply a access control condition, and there will be no result because user has no rights to see these ten medias.

Expected Behavior

The FindMedia method should return only available media for the user.

Steps to Reproduce

Create 2 collections, one with no permission, one with a view permission, add 10 medias on each.
Excecute the get method of the mediamanager with a ten media limit, There will be no results.

Possible Solutions

Add the access control condition as optional to the getIds method

@wachterjohannes wachterjohannes added the Bug Error or unexpected behavior of already existing functionality label Mar 8, 2018
@danrot
Copy link
Contributor

danrot commented Mar 12, 2018

Just to be sure: I have tried to reproduce the error with the following steps, do you think that this is the same issue?

  1. Create a new collection
  2. Upload one media to this collection
  3. Remove all permissions from this collection
  4. Go to the root of the media section where all medias are shown
  5. The media uploaded in the now secured collection is still visible

This would be a little bit easier for us to reproduce than having such a high number of media to test that.

@danrot
Copy link
Contributor

danrot commented Nov 28, 2019

Just tested it again, seems to be fixed.

@danrot danrot closed this as completed Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

No branches or pull requests

4 participants