Building a parking permit system in Glide, where multiple users living in the same apartment must be able to view, share, and edit the same permits (e.g., permanent parking permits)

I’m building a parking permit system in Glide, where multiple users living in the same apartment must be able to view, share, and edit the same permits (e.g., permanent parking permits).


:brick: I’m only using 2 tables:

1. Users table:

Columns:

  • Email

  • LejlighedsID (Apartment ID, e.g., “1”, “2A”)

  • Name

2. FastTilladelser table:

Columns:

  • License Plate (Nummerplade)

  • LejlighedsID


:white_check_mark: Goal:

  • When User A logs in, they should see all permits associated with their apartment (LejlighedsID)

  • When User B logs in (same LejlighedsID), they should see the exact same permits

  • Both users must be able to add and edit these shared permits


:bullseye: What I’ve already done:

  • I created a relation from Users.LejlighedsIDFastTilladelser.LejlighedsID
    → (:check_mark: Match multiple)

  • I display this relation using a Collection (List or Card component)

  • I use User Profile as the base of the screen (confirmed via Settings → User Profile Table)


:cross_mark: Problem:

  • When I log in as a user who shares the same LejlighedsID as another user, no permits are shown in the frontend

  • The permits do exist in the backend, and have the correct LejlighedsID

  • I’ve removed all filters and visibility conditions

  • I’ve selected the correct user using “Viewing as [email]”


:wrench: Desired functionality:

  • Users should automatically see and edit shared permits based on LejlighedsID

  • A maximum of 2 active permits per apartment (optional limit)

  • When creating a new permit, the LejlighedsID should automatically be assigned from the logged-in user’s profile


I don’t want to create a separate “Apartments” table — I want the system to work using just Users and FastTilladelser.

Can you help me find the best solution in Glide to make this work reliably?

Thanks.

1 Like

The way you have it set up should work. User/Apartment ID –> Permit/Apartment ID should yield the correct results. Can you share screenshots?

3 Likes

Hi @BGA and welcome! :slight_smile:


Viewing as

I think this is where the mistake comes from.
Your relation is probably done correctly but despite it’s name, Viewing as in this specific case doesn’t update the relation and stays with the same value (i.e.: the email you are currently logged in with I think).

Have you tested it out for real? I mean by log in as a different user, with a different email address? Do you still face the issue?


Adding values from User Profile

Assuming you’re using a form to let users add permits, there is a simple way to achieve that: in the form, simply add a LejlighedsID avaible under Values from User profile and target the column where this value should be stored:

When the user will hit the Submit button, it’s automatically gonna reach his/her own LeilighedsID value from their user profile and add it to the relevant column inside the FastTilladelser table.


Limit to 2 active permits

This one could also be easily done with this approach:

  1. Add a Rollup column (here Number of Permits) in your Users table to calculate the total of permits:
  2. In the layout, select your Collection and go to Actions → Allow users to add items → Add condition. Set up the condition to allow that action only if User Profile → Number or Permits is less than 2:

    Now, if a User has already 2 (or more) permits, the button isn’t displayed anymore, preventing any new addition :wink:

Row Owners

If your application should be secure, maybe you will be intersted in enabling Row Owners.
It’s the right way to make sure someone only sees what you want.

Even if it requires some technical skills, without this feature, all the data will be downloaded prior the calculation of the relation. Anyone could theorically access the data. To prevent that, here is the link to the docs: Row Owners | Glide Docs


I hope this answers your questions :wink:

2 Likes

HI Robert, thanx for the reply, I forgot to insert the role in user profil for the lejligheds ID.

i have fixed this, and after it , i moved to creating a another table. called Lejligheder tabel :slight_smile:

Hi Nicolas.
Thanx for your reply.
I forgot to insert the role in user profil for the lejligheds ID.

I have fixed this, and after it , i moved to creating a another table. called Lejligheder tabel :slight_smile:
to make things more structured and easier :slight_smile: