Button Visibility based on Table of Admin Users

I have a table of Teams. Each Team can have many Users who are Admins of that Team. I have a table called TeamAdmins with fields for User and Team.

I have a button for “Edit Post”. A Post belongs to a Team.

I only want the “Edit Post” button to appear if the current logged in user is in the TeamAdmin table.

However, this is never an option in the visibility filters.

Any thoughts on how to achieve this? Thanks!

Instead of using a separate table for TeamAdmins, I would just add a true/false property to your Users collection. Call it “Admin” and set the field to true for any users who are also Admins. Then make the button visible if User > Admin is true.

A user can be an admin of multiple teams and teams can have multiple admins.

So, I don’t think that will work.

| MikesClub
April 15 |

  • | - |

Instead of using a separate table for TeamAdmins, I would just add a true/false property to your Users collection. Call it “Admin” and set the field to true for any users who are also Admins. Then make the button visible if User > Admin is true.

Hi Chris,

Welcome to the community :partying_face:

Try this :

All TeamAdmins>Count>is equal to>1. And add a filter that User’s> ( I guess this is a One to Many to relationship between User and TeamAdmins ) email>is equal to>Logged in user’s> email.

Or you can create a Many to Many relationship between Users and Teams and add Current Post>Team’s>Users ( Many to Many relationship )>All>Contains>Logged in user.I have read some posts that when the users count increases in that relationship this will become slow. And they suggest to use Joint Tables like this. Not sure.

Thank you

Thank you, but I don’t seem to be able to get that to work.

To start with, shouldn’t I need something that says Current Logged In User is or is not linked to Team Admins for the Current Team?

Maybe I’m thinking too much like a SQL database.

The 2 ways? As for my knowledge the 1st way should work and the 2nd the way has to work for sure.

This logic is there when you use Many to Many relationships but Logged in user is in down in the filter as like Current Team>Admins>Contains>Logged in user or Current Team>Admins>Does not contains>Logged in user

For the first way, I have one to many relationship between User and TeamAdmin. Here is what I see on the screen. I don’t understand how you enter:

All TeamAdmins>Count>is equal to>1. And add a filter that User’s> ( I guess this is a One to Many to relationship between User and TeamAdmins ) email>is equal to>Logged in user’s> email.

into the Visibility filter.

Add this filter :

It is still showing the button for all users who are TeamAdmin of any Team. I need the button to only display for TeamAdmin of that particular Team.

If logged in as a User who is not TeamAdmin of any Team, then button does not display.

Thank you so much for all your help!!!

Ah I guess I understand what you want to do! You have a post and that post belongs to a Team and if that Team’s admins view that show the button and if not don’t show. Correct?

Then you need to add the filter like this ( same but select current post>team’s>admins>count ) :

Your Welcome!

That works!!! Thank you!

I guess I don’t fully understand the logic behind why the filter on Count = 1 ???

If viewed in a web browser, would a non-TeamAdmin be able to go to a specific URL and edit or add posts as if they were a TeamAdmin? Just wondering how “secure” these visibility settings are???

Awesome and Your Welcome!

It’s like if the Logged in user is in the Admins table. Like if there is a record that is the Logged in user then the count becomes 1 and button displays. But if Logged in user is not on that Table then button is not visible.

I believe they are secure! If that user is not a admin then that user should not see the button.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.