OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions How to filter the datagrid based on the ACL

This topic contains 2 replies, has 2 voices, and was last updated by  Bernhard Kau 8 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #33906

    Bernhard Kau
    Participant

    I am just started using the OroPlatform (and Symfony in general) and right now most things I can figure out. But one thing I don’t like with the datagrids. When you want to filter out all entity item, that do not belong to the current user, you have to do something like this in the “datagrid.yml” file:

    So the filter to hide entity items, that should not be shown do any user, you have to make sure to filter your datagrid accordingly. I also added an additional datagrid for a dashboard widget, where I had to add the exact same “where” clause.

    My question is: Can I filter the entity item somewhere more central, so that a developer cannot accidentally forget the filter, when he creates a datagrid (or any other view, that queries entity item). I haven’t used entity repositories, providers or things like that. Would it be possible to filter the items in such classes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #33907

    Vova Soroka
    Participant

    Hello Bernhard!

    One of solutions is to use query hints. Please look at
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/EntityBundle/Resources/doc/query_hint_resolver.md
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datasources/orm.md#query-hints

    Here is an example

    #33908

    Bernhard Kau
    Participant

    Hey thanks for your reply Vova! That still would require a developer not to forget to add the “hints”, but it’s still a pretty neat functionality as the WHERE will be more complex as the application get’s more functionailty and you than only have to update the hint. Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top