Blazor WBA Filter Row Data (Security)

Hi,

is it possible to filter the row data per User Role?

For example I can show firstname and lastname in a grid and hide the street.
But with fiddler I will see the street.

Thanks.

What is the row data? What do you want to filter and how do you obtain it? How is that data related to user roles?

I am not sure what this means. Can you elaborate on what you are trying to achieve?

For example here is the data:

firstname / lastname / street / company
Max Mustermann Musterstrasse Musterfirma

When I create the datagrid to show firstname and lastname to the user, the application will also download the street and the company.
If a user is able to download fiddler he will see the street and the company.
I would like to only load the firstname and lastname.
Thanks.

Hi @MarkusW,

You need $select to achieve this however at the moment this is not supported. We will do our best to provide support in our next update.

Hi,

now I tried the Select operator in the on...read function, but there is an error -> maybe you have a solution or I have to wait for un update?

Thanks.

The Select() will return new anonymous type, you cannot cast it to the original type.

You have a workaround for me for this now or I have to wait for an update?
Thanks.

Hey @MarkusW,

Not sure what workaround you expect - you cannot cast one type to another.

In your first answer you wrote that I need the $select to achieve this.
-> so I tried the select in the on...read method -> but it is not possible

So I have to wait for the next update to solve my problem?

Yes, $select is a missing feature that we've decided to add in the next update. Your code with the wrong explicit cast is something custom that is not related to what we've added.

1 Like

Thanks.
When is the next update? Where I have to use the $select?

The next update will be tomorrow. You can use this parameter in every database method invoke that will return collection, you will need however to reinfer your data source in to be added to the meta the $select parameter.

Hi @enchev ,

thanks. Now it is working for the grid.
Another question: If I click on the row for the detail screen all the data is loaded, is the select operator also possible for the detail screen? Thanks.

To repeat what I’ve already posted.

In the edit Screen there ist the method get...ById.
So it does not return a collection and it is not possible to select the data?

Yes, for single entity it’s not possible.

Is there another way to do this with a single entity?

Is it possible to load a collection with one entity to do this?
Thanks.

When you get a collection you have access to every entity, for example FirstOrDefault() will return first item. You use also ToList() and indexer and you can also apply filter to return a collection with single item.

Hi,

now I tried to first get my collections and used the FirstorDefault with result. But FirstorDefault is not supported?
Is there a tutorial or a documentation how to do this? Thanks.

I strongly suggest you to read official Microsoft documentation: