Filtering image based on user's profile

Hi guys,
I am new to glide. I am trying to create a tool for rental host.
I have " property owner " and " Villa " tables.
In the layout I would like the " property owner " who is also in the User table, to only see his Villas pictures.
So I’ve added a Grid component displaying all the villas that are in " property owner " table.
But I don’t how to filter it so Owner A can only see his.
Need help

Create a relation in the owner table linking the owner to the villas table. Then you should be able to set the source if the collection to be the relation.

Hi Jeff ! thanks for helping :pray:t4:

I did it already. The component actually links to " lookup_pics_villa " on Villa owner table , but it displays every owners villa pics.
I tried many things to filter down

Unless I’m missing something, shouldn’t the grid be sourced from the relation?

When I click on " source " I only have “main table list”. I can’t dive into it and select relations. Then inside the " items data" it automatically retrieve " lookup_pics_villa

Is the screen itself connected to a user row?

Scroll all the way to the end of the table list. You should see your relation there.

4 Likes

i don’t, just the main tables

the screen itself is connected to user table
Then i have added components to make it a homepage

You are showing that the grid itself is connected to the user table, but I can’t tell from your screenshot which table the screen is connected to.

If everything is set up correctly, I believe your Home screen/tab should be connected to the user table and should be filtered to the signed in user. Then when you add a collection you should see the relation as an option for the source of your grid collection.

I may have missed something while creating User Table. I have added the "villa owners " as " users " so I can be in their shoes while checking their properties.
The Home screen is linked with “user table”.
But i am a bit lost regarding the " sign-in " part. is it related to " privacy setting " ?

Optional, required or no sign-in are indeed related to your privacy settings. Here is Darren’s chart to give you an overview.

As for the visibility of items in the Villa table, if these items only need to be viewed by their owner and nobody else ever, I think I would first have applied row ownership in the Villa table to filter data at the data level. This would improve performance.

I was under the assumption that the Proprietaire table WAS the User table. That’s why you don’t see the relation. Your screen is attached to the user table, which does not have that relation. You either need to change the source table for the screen, or add the relation to the user table, or do as @nathanaelb say and just use Row Owners (but only if data will never be shared with different users).

1 Like

it works :pray:t4:
Proprietaire became User Table and magic happened lol
Thank you guys ! @nathanaelb and @Darren_Murphy too !

I will be back soon i guess :sweat_smile:

2 Likes

Ah, apparently the Propriétaire table wasn’t set up for user profiles from the beginning :sweat_smile:

If the users in your Propriétaire table never ever need to see each other’s data (just like we both have Gmail accounts, I assume, but you are not to see my emails and I am not to see yours), then you might consider setting up row ownership in the tables other than Propriétaire so the data stays strictly segregated.

See you soon and welcome to Glide’s community forum.

1 Like

Hi,
Can someone post a similar exemple app or video because i have a similar problem that I can’t fix, i don’t see where my problem are with relations. In my case the images data are not strictly segregated the users can see images from others,