locked
"*_filter" method? RRS feed

  • Question

  • hi!

    im little confused about query *_filter method? when it is applied? if i create filter based on table, is this then valid for all queries i'm creating for that specific table? will this *_filter method be used in autogenerated addEdit modal screens (for default)? i need to implement filter based on what categories user can see, categories are mapped to user across mapping table (many to many - users_categories) and when specific user create Product, he must be able to choose only categories which he can access to (or see).. thanks!

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Monday, June 3, 2013 7:38 AM

Answers

  • I haven't used it myself yet (only just started to use VS 2012), but my understanding is that you are correct. That is what the Filter method was created for.

    Yann Duran
         - Co-Author of Pro Visual Studio LightSwitch 2011
         - Author of the  LightSwitch Central Blog

    FREE Download: Luminous Tools for LightSwitch
    (a Visual Studio productivity extension for LightSwitch)
     
    Click Mark as Answer, if someone's reply answers your question
    Click  Vote as Helpful, if someone's reply is helpful
     
    By doing this you'll help everyone find answers faster.

    • Marked as answer by Kivito Tuesday, June 4, 2013 6:28 AM
    Monday, June 3, 2013 6:42 PM
    Moderator
  • Indeed, *_filter is really intended for robust row level security. Imagine you have a such a filter on customer, all queries on customer will respect that filter, but... also the navigation properties !

    E.g.: If you have a row level on customers and you have a simple order list (where customer is a reference property), you will be able to enlist all orders (also from customers you may not see) but you will on get the related customer info which you "may" see.  That was different in V1, when using the preprocessquery method on customers.


    paul van bladel

    • Marked as answer by Kivito Tuesday, June 4, 2013 6:28 AM
    Monday, June 3, 2013 8:38 PM

All replies

  • I haven't used it myself yet (only just started to use VS 2012), but my understanding is that you are correct. That is what the Filter method was created for.

    Yann Duran
         - Co-Author of Pro Visual Studio LightSwitch 2011
         - Author of the  LightSwitch Central Blog

    FREE Download: Luminous Tools for LightSwitch
    (a Visual Studio productivity extension for LightSwitch)
     
    Click Mark as Answer, if someone's reply answers your question
    Click  Vote as Helpful, if someone's reply is helpful
     
    By doing this you'll help everyone find answers faster.

    • Marked as answer by Kivito Tuesday, June 4, 2013 6:28 AM
    Monday, June 3, 2013 6:42 PM
    Moderator
  • Indeed, *_filter is really intended for robust row level security. Imagine you have a such a filter on customer, all queries on customer will respect that filter, but... also the navigation properties !

    E.g.: If you have a row level on customers and you have a simple order list (where customer is a reference property), you will be able to enlist all orders (also from customers you may not see) but you will on get the related customer info which you "may" see.  That was different in V1, when using the preprocessquery method on customers.


    paul van bladel

    • Marked as answer by Kivito Tuesday, June 4, 2013 6:28 AM
    Monday, June 3, 2013 8:38 PM
  • thanks guys!

    i've played yesterday with filtering and i must admit that this is really powerful.. in just 4 lines of code i bring security to whole new level without messing with screen queries (ie. for ACB), great stuff! thanks again!

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Tuesday, June 4, 2013 6:28 AM